From edea13dec2249e1b44606d1cf146a1c14c5b5d0d Mon Sep 17 00:00:00 2001 From: Gekctek Date: Wed, 5 Mar 2025 21:17:40 -0800 Subject: [PATCH 01/20] Overhauling SignedContent to be able to sign separately --- .../Address/AddressBookApiClient.cs | 11 +- src/Agent/Agents/HttpAgent.cs | 223 +++++---------- src/Agent/Agents/IAgent.cs | 258 +++++++++++++----- src/Agent/Identities/IIdentity.cs | 24 +- src/Agent/Models/Certificate.cs | 6 +- src/Agent/Models/SignedContent.cs | 34 ++- src/Agent/Requests/CallRequest.cs | 6 +- src/Agent/Requests/QueryRequest.cs | 10 +- src/BLS/API.xml | 23 -- src/BLS/BypassedBlsCryptography.cs | 19 -- src/BLS/DefaultBlsCryptograhy.cs | 8 +- src/BLS/IBlsCryptography.cs | 26 -- src/BLS/Properties/AssemblyInfo.cs | 1 + src/Candid/API.xml | 4 +- src/Candid/Models/IHashable.cs | 2 +- src/Candid/Models/RequestId.cs | 9 +- test/BLS.Tests/DefaultBlsCryptographyTests.cs | 4 +- 17 files changed, 322 insertions(+), 346 deletions(-) delete mode 100644 src/BLS/BypassedBlsCryptography.cs delete mode 100644 src/BLS/IBlsCryptography.cs diff --git a/samples/Sample.Shared/Address/AddressBookApiClient.cs b/samples/Sample.Shared/Address/AddressBookApiClient.cs index 9d9c797c..3b4ab98b 100644 --- a/samples/Sample.Shared/Address/AddressBookApiClient.cs +++ b/samples/Sample.Shared/Address/AddressBookApiClient.cs @@ -32,25 +32,22 @@ public async Task _set_address(string name, Address addr) public async Task> _get_address(string name) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(name, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_address", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_address", arg); return reply.ToObjects>(this.Converter); } public async Task _get_self() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_self", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_self", arg); return reply.ToObjects(this.Converter); } public async Task _get_dict() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_dict", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_dict", arg); return reply.ToObjects(this.Converter); } } -} \ No newline at end of file +} diff --git a/src/Agent/Agents/HttpAgent.cs b/src/Agent/Agents/HttpAgent.cs index cf79ec54..51207d2e 100644 --- a/src/Agent/Agents/HttpAgent.cs +++ b/src/Agent/Agents/HttpAgent.cs @@ -7,19 +7,14 @@ using EdjCase.ICP.Candid.Utilities; using System; using System.Collections.Generic; -using System.IO; using System.Net.Http; -using System.Text; using System.Threading.Tasks; using EdjCase.ICP.Agent.Agents.Http; -using System.Net.Http.Headers; using System.Formats.Cbor; -using EdjCase.ICP.Candid.Encodings; -using System.Linq; using EdjCase.ICP.BLS; using System.Threading; using System.Security.Cryptography; -using System.Diagnostics; +using Org.BouncyCastle.Asn1.Ocsp; namespace EdjCase.ICP.Agent.Agents { @@ -30,73 +25,51 @@ public class HttpAgent : IAgent { private byte[]? rootKeyCache = null; - /// - /// The identity that will be used on each request unless overriden - /// This identity can be anonymous - /// - public IIdentity? Identity { get; set; } - private readonly IHttpClient httpClient; - private readonly IBlsCryptography bls; private bool v3CallSupported = true; - /// Optional. Identity to use for each request. If unspecified, will use anonymous identity - /// Optional. Bls crypto implementation to validate signatures. If unspecified, will use default implementation /// Optional. Sets the http client to use, otherwise will use the default http client - public HttpAgent( - IHttpClient httpClient, - IIdentity? identity = null, - IBlsCryptography? bls = null - ) + public HttpAgent(IHttpClient httpClient) { - this.Identity = identity; this.httpClient = httpClient ?? throw new ArgumentNullException(nameof(httpClient)); - this.bls = bls ?? new DefaultBlsCryptograhy(); } - /// Optional. Identity to use for each request. If unspecified, will use anonymous identity - /// Optional. Bls crypto implementation to validate signatures. If unspecified, will use default implementation /// Url to the boundry node to connect to. Defaults to `https://ic0.app/` - public HttpAgent( - IIdentity? identity = null, - Uri? httpBoundryNodeUrl = null, - IBlsCryptography? bls = null - ) + public HttpAgent(Uri? httpBoundryNodeUrl = null) { - this.Identity = identity; this.httpClient = new DefaultHttpClient(new HttpClient() { BaseAddress = httpBoundryNodeUrl ?? new Uri("https://ic0.app/") }); - this.bls = bls ?? new DefaultBlsCryptograhy(); } + + + + /// public async Task CallAsync( - Principal canisterId, - string method, - CandidArg arg, + SignedContent content, Principal? effectiveCanisterId = null, CancellationToken? cancellationToken = null ) { - if (!this.v3CallSupported) - { - return await this.CallAsynchronousAndWaitAsync(canisterId, method, arg, effectiveCanisterId, cancellationToken); - } - effectiveCanisterId ??= canisterId; - (HttpResponse httpResponse, RequestId requestId) = await this.SendAsync($"/api/v3/canister/{effectiveCanisterId.ToText()}/call", BuildRequest, cancellationToken); + effectiveCanisterId ??= content.Request.CanisterId; + string url = this.GetCallUrl(effectiveCanisterId, this.v3CallSupported); + + HttpResponse httpResponse = await this.SendAsync(url, content, cancellationToken); + if (httpResponse.StatusCode == System.Net.HttpStatusCode.NotFound) { // If v3 is not available, fall back to v2 this.v3CallSupported = false; - return await this.CallAsynchronousAndWaitAsync(canisterId, method, arg, effectiveCanisterId, cancellationToken); + return await ((IAgent)this).CallAsynchronousAndWaitAsync(content, effectiveCanisterId, cancellationToken); } if (httpResponse.StatusCode == System.Net.HttpStatusCode.Accepted) { // If request takes too long, then it will return 202 Accepted and polling is required - return await this.WaitForRequestAsync(canisterId, requestId, cancellationToken); + return await ((IAgent)this).WaitForRequestAsync(content.Request.CanisterId, content.RequestId, cancellationToken); } await httpResponse.ThrowIfErrorAsync(); @@ -105,12 +78,12 @@ public async Task CallAsync( V3CallResponse v3CallResponse = V3CallResponse.ReadCbor(reader); SubjectPublicKeyInfo rootPublicKey = await this.GetRootKeyAsync(cancellationToken); - if (!v3CallResponse.Certificate.IsValid(this.bls, rootPublicKey)) + if (!v3CallResponse.Certificate.IsValid(rootPublicKey)) { throw new InvalidCertificateException("Certificate signature does not match the IC public key"); } - HashTree? requestStatusData = v3CallResponse.Certificate.Tree.GetValueOrDefault(StatePath.FromSegments("request_status", requestId.RawValue)); - RequestStatus? requestStatus = ParseRequestStatus(requestStatusData); + HashTree? requestStatusData = v3CallResponse.Certificate.Tree.GetValueOrDefault(StatePath.FromSegments("request_status", content.RequestId.RawValue)); + RequestStatus? requestStatus = IAgent.ParseRequestStatus(requestStatusData); switch (requestStatus?.Type) { case RequestStatus.StatusType.Replied: @@ -127,30 +100,19 @@ public async Task CallAsync( default: throw new NotImplementedException($"Invalid request status '{requestStatus.Type}'"); } - - CallRequest BuildRequest(Principal sender, ICTimestamp now) - { - byte[] nonce = new byte[16]; - RandomNumberGenerator.Fill(nonce); - return new CallRequest(canisterId, method, arg, sender, now, nonce); - } } - /// public async Task CallAsynchronousAsync( - Principal canisterId, - string method, - CandidArg arg, + SignedContent content, Principal? effectiveCanisterId = null, CancellationToken? cancellationToken = null ) { - if (effectiveCanisterId == null) - { - effectiveCanisterId = canisterId; - } - (HttpResponse httpResponse, RequestId requestId) = await this.SendAsync($"/api/v2/canister/{effectiveCanisterId.ToText()}/call", BuildRequest, cancellationToken); + effectiveCanisterId ??= content.Request.CanisterId; + string url = this.GetCallUrl(effectiveCanisterId, false); + + HttpResponse httpResponse = await this.SendAsync(url, content, cancellationToken); await httpResponse.ThrowIfErrorAsync(); if (httpResponse.StatusCode == System.Net.HttpStatusCode.OK) @@ -172,44 +134,32 @@ public async Task CallAsynchronousAsync( } throw new CallRejectedException(response.Code, response.Message, response.ErrorCode); } - return requestId; - - CallRequest BuildRequest(Principal sender, ICTimestamp now) - { - byte[] nonce = new byte[16]; - RandomNumberGenerator.Fill(nonce); - return new CallRequest(canisterId, method, arg, sender, now, nonce); - } + return content.RequestId; } /// - public async Task QueryAsync( - Principal canisterId, - string method, - CandidArg arg, + public async Task QueryAsync( + SignedContent content, + Principal? effectiveCanisterId = null, CancellationToken? cancellationToken = null ) { - (HttpResponse httpResponse, RequestId requestId) = await this.SendAsync($"/api/v2/canister/{canisterId.ToText()}/query", BuildRequest, cancellationToken); + effectiveCanisterId ??= content.Request.CanisterId; + HttpResponse httpResponse = await this.SendAsync($"/api/v2/canister/{effectiveCanisterId.ToText()}/query", content, cancellationToken); await httpResponse.ThrowIfErrorAsync(); byte[] cborBytes = await httpResponse.GetContentAsync(); - return QueryResponse.ReadCbor(new CborReader(cborBytes)); - - QueryRequest BuildRequest(Principal sender, ICTimestamp now) - { - return new QueryRequest(canisterId, method, arg, sender, now); - } + return QueryResponse.ReadCbor(new CborReader(cborBytes)).ThrowOrGetReply(); } /// public async Task ReadStateAsync( Principal canisterId, - List paths, + SignedContent content, CancellationToken? cancellationToken = null ) { string url = $"/api/v2/canister/{canisterId.ToText()}/read_state"; - (HttpResponse httpResponse, RequestId requestId) = await this.SendAsync(url, BuildRequest, cancellationToken); + HttpResponse httpResponse = await this.SendAsync(url, content, cancellationToken); await httpResponse.ThrowIfErrorAsync(); byte[] cborBytes = await httpResponse.GetContentAsync(); @@ -217,61 +167,44 @@ public async Task ReadStateAsync( ReadStateResponse response = ReadStateResponse.ReadCbor(reader); SubjectPublicKeyInfo rootPublicKey = await this.GetRootKeyAsync(cancellationToken); - if (!response.Certificate.IsValid(this.bls, rootPublicKey)) + if (!response.Certificate.IsValid(rootPublicKey)) { throw new InvalidCertificateException("Certificate signature does not match the IC public key"); } return response; - - ReadStateRequest BuildRequest(Principal sender, ICTimestamp now) - { - return new ReadStateRequest(paths, sender, now); - } } - /// - public async Task GetRequestStatusAsync( - Principal canisterId, - RequestId id, - CancellationToken? cancellationToken = null - ) - { - var pathRequestStatus = StatePath.FromSegments("request_status", id.RawValue); - var paths = new List { pathRequestStatus }; - ReadStateResponse response = await this.ReadStateAsync(canisterId, paths, cancellationToken); - HashTree? requestStatus = response.Certificate.Tree.GetValueOrDefault(pathRequestStatus); - return ParseRequestStatus(requestStatus); - } - private static RequestStatus? ParseRequestStatus(HashTree? requestStatus) + + + + + + + + + + + + + + + + + private string GetCallUrl(Principal canisterId, bool v3) { - string? status = requestStatus?.GetValueOrDefault("status")?.AsLeaf().AsUtf8(); - //received, processing, replied, rejected or done - switch (status) + if (v3) { - case null: - return null; - case "received": - return RequestStatus.Received(); - case "processing": - return RequestStatus.Processing(); - case "replied": - HashTree.EncodedValue r = requestStatus!.GetValueOrDefault("reply")!.AsLeaf(); - return RequestStatus.Replied(CandidArg.FromBytes(r)); - case "rejected": - RejectCode code = (RejectCode)(ulong)requestStatus!.GetValueOrDefault("reject_code")!.AsLeaf().AsNat(); - string message = requestStatus.GetValueOrDefault("reject_message")!.AsLeaf().AsUtf8(); - string? errorCode = requestStatus.GetValueOrDefault("error_code")?.AsLeaf().AsUtf8(); - return RequestStatus.Rejected(code, message, errorCode); - case "done": - return RequestStatus.Done(); - default: - throw new NotImplementedException($"Invalid request status '{status}'"); + return $"/api/v3/canister/{canisterId.ToText()}/call"; } + return $"/api/v2/canister/{canisterId.ToText()}/call"; } + + + /// public async Task GetRootKeyAsync( CancellationToken? cancellationToken = null @@ -302,56 +235,22 @@ public async Task GetReplicaStatusAsync( return StatusResponse.ReadCbor(new CborReader(bytes)); } - private async Task<(HttpResponse Response, RequestId RequestId)> SendAsync( + + private async Task SendAsync( string url, - Func getRequest, + SignedContent content, CancellationToken? cancellationToken = null ) where TRequest : IRepresentationIndependentHashItem { - Principal principal; - if (this.Identity == null) - { - principal = Principal.Anonymous(); - } - else - { - SubjectPublicKeyInfo publicKey = this.Identity.GetPublicKey(); - principal = publicKey.ToPrincipal(); - } - TRequest request = getRequest(principal, ICTimestamp.Future(TimeSpan.FromMinutes(3))); - Dictionary content = request.BuildHashableItem(); - - SignedContent signedContent; - if (this.Identity == null) - { - signedContent = new SignedContent(content, null, null, null); - } - else - { - signedContent = this.Identity.SignContent(content); - } - - - byte[] cborBody = this.SerializeSignedContent(signedContent); + byte[] cborBody = content.ToCborBytes(); #if DEBUG string hex = ByteUtil.ToHexString(cborBody); #endif - HttpResponse httpResponse = await this.httpClient.PostAsync(url, cborBody, cancellationToken); - var sha256 = SHA256HashFunction.Create(); - RequestId requestId = RequestId.FromObject(content, sha256); // TODO this is redundant, `CreateSignedContent` hashes it too - return (httpResponse, requestId); + return await this.httpClient.PostAsync(url, cborBody, cancellationToken); - } - private byte[] SerializeSignedContent(SignedContent signedContent) - { - var writer = new CborWriter(); - writer.WriteTag(CborTag.SelfDescribeCbor); - signedContent.WriteCbor(writer); - return writer.Encode(); } - } } diff --git a/src/Agent/Agents/IAgent.cs b/src/Agent/Agents/IAgent.cs index cc4aa4ec..45dc161d 100644 --- a/src/Agent/Agents/IAgent.cs +++ b/src/Agent/Agents/IAgent.cs @@ -1,9 +1,14 @@ using EdjCase.ICP.Agent.Identities; +using EdjCase.ICP.Agent.Models; +using EdjCase.ICP.Agent.Requests; using EdjCase.ICP.Agent.Responses; +using EdjCase.ICP.Candid.Crypto; using EdjCase.ICP.Candid.Models; using System; using System.Collections.Generic; +using System.Reflection; using System.Runtime.CompilerServices; +using System.Security.Cryptography; using System.Threading; using System.Threading.Tasks; @@ -15,28 +20,48 @@ namespace EdjCase.ICP.Agent.Agents /// public interface IAgent { + Task CallAsync(SignedContent content, Principal? effectiveCanisterId = null, CancellationToken? cancellationToken = null); + Task CallAsynchronousAsync(SignedContent content, Principal? effectiveCanisterId = null, CancellationToken? cancellationToken = null); + Task QueryAsync(SignedContent content, Principal? effectiveCanisterId = null, CancellationToken? cancellationToken = null); + Task ReadStateAsync(Principal canisterId, SignedContent content, CancellationToken? cancellationToken = null); + + /// + /// Gets the status of the IC replica. This includes versioning information + /// about the replica + /// + /// A response containing all replica status information + Task GetReplicaStatusAsync(CancellationToken? cancellationToken = null); + /// - /// The identity to use for requests. If null, then it will use the anonymous identity + /// Gets the root public key of the current Internet Computer network /// - public IIdentity? Identity { get; set; } + /// Optional. Token to cancel request + /// The root public key bytes + Task GetRootKeyAsync(CancellationToken? cancellationToken = null); + + /// /// Gets the state of a specified canister with the subset of state information /// specified by the paths parameter /// /// Canister to read state for /// The state paths to get information for. Other state data will be pruned if not specified + /// Optional. Identity to sign the request with /// Optional. Token to cancel request /// A response that contains the certificate of the current canister state - Task ReadStateAsync(Principal canisterId, List paths, CancellationToken? cancellationToken = null); + public async Task ReadStateAsync( + Principal canisterId, + List paths, + IIdentity? identity = null, + CancellationToken? cancellationToken = null) + { + SignedContent content = this.SignContent( + identity, + (sender, ingressExpiry) => new ReadStateRequest(paths, sender, ingressExpiry) + ); + return await this.ReadStateAsync(canisterId, content, cancellationToken); + } - /// - /// Gets the status of a request that is being processed by the specified canister - /// - /// Canister where the request was sent to - /// Id of the request to get a status for - /// Optional. Token to cancel request - /// A status variant of the request. If request is not found, will return null - Task GetRequestStatusAsync(Principal canisterId, RequestId id, CancellationToken? cancellationToken = null); /// /// Sends a call request to a specified canister method and gets the response candid arg back using /v3/../call @@ -45,30 +70,31 @@ public interface IAgent /// Canister to read state for /// The name of the method to call on the canister /// The candid arg to send with the request + /// Optional. Identity to sign the request with + /// Optional. If specified will make the request unique even with the same arguments /// Optional. Specifies the relevant canister id if calling the root canister /// Optional. Token to cancel request /// The id of the request that can be used to look up its status with `GetRequestStatusAsync` - Task CallAsync(Principal canisterId, string method, CandidArg arg, Principal? effectiveCanisterId = null, CancellationToken? cancellationToken = null); - - /// - /// Sends a call request to a specified canister method and gets back an id of the - /// request that is being processed using /v2/../call. This call does NOT wait for the request to be complete. - /// Either check the status with `GetRequestStatusAsync` or use the `CallV2AndWaitAsync` method - /// - /// Canister to read state for - /// The name of the method to call on the canister - /// The candid arg to send with the request - /// Optional. Specifies the relevant canister id if calling the root canister - /// Optional. Token to cancel request - /// The id of the request that can be used to look up its status with `GetRequestStatusAsync` - Task CallAsynchronousAsync(Principal canisterId, string method, CandidArg arg, Principal? effectiveCanisterId = null, CancellationToken? cancellationToken = null); + public async Task CallAsync( + Principal canisterId, + string method, + CandidArg arg, + IIdentity? identity = null, + byte[]? nonce = null, + Principal? effectiveCanisterId = null, + CancellationToken? cancellationToken = null + ) + { + SignedContent content = this.SignContent( + identity, + (sender, ingressExpiry) => + { + return new CallRequest(canisterId, method, arg, sender, ingressExpiry, nonce); + } + ); + return await this.CallAsync(content, effectiveCanisterId, cancellationToken); + } - /// - /// Gets the status of the IC replica. This includes versioning information - /// about the replica - /// - /// A response containing all replica status information - Task GetReplicaStatusAsync(CancellationToken? cancellationToken = null); /// /// Sends a query request to a specified canister method @@ -76,67 +102,121 @@ public interface IAgent /// Canister to read state for /// The name of the method to call on the canister /// The candid arg to send with the request + /// Optional. If specified will make the request unique even with the same arguments + /// Optional. Identity to sign the request with + /// Optional. Specifies the relevant canister id if calling the root canister /// Optional. Token to cancel request /// The response data of the query call - Task QueryAsync(Principal canisterId, string method, CandidArg arg, CancellationToken? cancellationToken = null); + public async Task QueryAsync( + Principal canisterId, + string method, + CandidArg arg, + byte[]? nonce = null, + IIdentity? identity = null, + Principal? effectiveCanisterId = null, + CancellationToken? cancellationToken = null + ) + { + SignedContent content = this.SignContent( + identity, + (sender, ingressExpiry) => new QueryRequest(canisterId, method, arg, sender, ingressExpiry, nonce) + ); + return await this.QueryAsync(content, effectiveCanisterId, cancellationToken); + } - /// - /// Gets the root public key of the current Internet Computer network - /// - /// Optional. Token to cancel request - /// The root public key bytes - Task GetRootKeyAsync(CancellationToken? cancellationToken = null); - } - /// - /// Extension methods for the `IAgent` interface - /// - public static class IAgentExtensions - { /// - /// Wrapper to call `CallAsync` (v3/.../call) to avoid breaking auto generated clients - /// If v2/.../call is wanted, use `CallV2AndWaitAsync` + /// Sends a call request to a specified canister method and gets back an id of the + /// request that is being processed using /v2/../call. This call does NOT wait for the request to be complete. + /// Either check the status with `GetRequestStatusAsync` or use the `CallV2AndWaitAsync` method /// - /// The agent to use for the call /// Canister to read state for /// The name of the method to call on the canister /// The candid arg to send with the request + /// Optional. Identity to sign the request with + /// Optional. If specified will make the request unique even with the same arguments /// Optional. Specifies the relevant canister id if calling the root canister /// Optional. Token to cancel request /// The id of the request that can be used to look up its status with `GetRequestStatusAsync` - [Obsolete("Use CallAsync or CallAsynchronousAndWaitAsync instead")] - public static async Task CallAndWaitAsync( - this IAgent agent, + public async Task CallAsynchronousAsync( Principal canisterId, string method, CandidArg arg, + IIdentity? identity = null, + byte[]? nonce = null, Principal? effectiveCanisterId = null, - CancellationToken? cancellationToken = null) + CancellationToken? cancellationToken = null + ) { - return await agent.CallAsync(canisterId, method, arg, effectiveCanisterId, cancellationToken); + SignedContent content = this.SignContent( + identity, + (sender, ingressExpiry) => + { + return new CallRequest(canisterId, method, arg, sender, ingressExpiry, nonce); + } + ); + return await this.CallAsynchronousAsync(content, effectiveCanisterId, cancellationToken); } + + /// /// Sends a call request to a specified canister method, waits for the request to be processed, /// the returns the candid response to the call. This is helper method built on top of `CallAsynchronousAsync` /// to wait for the response so it doesn't need to be implemented manually /// - /// The agent to use for the call /// Canister to read state for /// The name of the method to call on the canister /// The candid arg to send with the request + /// Optional. Identity to sign the request with + /// Optional. If specified will make the request unique even with the same arguments /// Optional. Specifies the relevant canister id if calling the root canister /// Optional. Token to cancel request /// The raw candid arg response - public static async Task CallAsynchronousAndWaitAsync( - this IAgent agent, + public async Task CallAsynchronousAndWaitAsync( Principal canisterId, string method, CandidArg arg, + IIdentity? identity = null, + byte[]? nonce = null, Principal? effectiveCanisterId = null, CancellationToken? cancellationToken = null) { - RequestId id = await agent.CallAsynchronousAsync(canisterId, method, arg, effectiveCanisterId); - return await agent.WaitForRequestAsync(canisterId, id, cancellationToken); + RequestId id = await this.CallAsynchronousAsync(canisterId, method, arg, identity, nonce, effectiveCanisterId, cancellationToken); + return await this.WaitForRequestAsync(canisterId, id, cancellationToken); + } + + + public async Task CallAsynchronousAndWaitAsync( + SignedContent content, + Principal? effectiveCanisterId = null, + CancellationToken? cancellationToken = null) + { + RequestId id = await this.CallAsynchronousAsync(content, effectiveCanisterId, cancellationToken); + return await this.WaitForRequestAsync(content.Request.CanisterId, id, cancellationToken); + } + + + /// + /// Gets the status of a request that is being processed by the specified canister + /// + /// Canister where the request was sent to + /// Id of the request to get a status for + /// Optional. Identity to sign the request with + /// Optional. Token to cancel request + /// A status variant of the request. If request is not found, will return null + public async Task GetRequestStatusAsync( + Principal canisterId, + RequestId id, + IIdentity? identity = null, + CancellationToken? cancellationToken = null + ) + { + var pathRequestStatus = StatePath.FromSegments("request_status", id.RawValue); + var paths = new List { pathRequestStatus }; + SignedContent signedContent = this.SignContent(identity, (sender, ingressExpiry) => new ReadStateRequest(paths, sender, ingressExpiry)); + ReadStateResponse response = await this.ReadStateAsync(canisterId, signedContent, cancellationToken); + HashTree? requestStatus = response.Certificate.Tree.GetValueOrDefault(pathRequestStatus); + return ParseRequestStatus(requestStatus); } /// @@ -144,13 +224,11 @@ public static async Task CallAsynchronousAndWaitAsync( /// method built on top of `GetRequestStatusAsync` to wait for the response so it doesn't need to be /// implemented manually /// - /// The agent to use for the call /// Canister to read state for /// The unique identifier for the request /// Optional. Token to cancel request /// The raw candid arg response - public static async Task WaitForRequestAsync( - this IAgent agent, + public async Task WaitForRequestAsync( Principal canisterId, RequestId requestId, CancellationToken? cancellationToken = null @@ -160,7 +238,7 @@ public static async Task WaitForRequestAsync( { cancellationToken?.ThrowIfCancellationRequested(); - RequestStatus? requestStatus = await agent.GetRequestStatusAsync(canisterId, requestId); + RequestStatus? requestStatus = await this.GetRequestStatusAsync(canisterId, requestId); cancellationToken?.ThrowIfCancellationRequested(); @@ -180,5 +258,63 @@ public static async Task WaitForRequestAsync( } } } + + + internal static RequestStatus? ParseRequestStatus(HashTree? requestStatus) + { + string? status = requestStatus?.GetValueOrDefault("status")?.AsLeaf().AsUtf8(); + //received, processing, replied, rejected or done + switch (status) + { + case null: + return null; + case "received": + return RequestStatus.Received(); + case "processing": + return RequestStatus.Processing(); + case "replied": + HashTree.EncodedValue r = requestStatus!.GetValueOrDefault("reply")!.AsLeaf(); + return RequestStatus.Replied(CandidArg.FromBytes(r)); + case "rejected": + RejectCode code = (RejectCode)(ulong)requestStatus!.GetValueOrDefault("reject_code")!.AsLeaf().AsNat(); + string message = requestStatus.GetValueOrDefault("reject_message")!.AsLeaf().AsUtf8(); + string? errorCode = requestStatus.GetValueOrDefault("error_code")?.AsLeaf().AsUtf8(); + return RequestStatus.Rejected(code, message, errorCode); + case "done": + return RequestStatus.Done(); + default: + throw new NotImplementedException($"Invalid request status '{status}'"); + } + } + + + private SignedContent SignContent( + IIdentity? identity, + Func getRequest + ) + where TRequest : IRepresentationIndependentHashItem + { + + Principal principal; + if (identity == null) + { + principal = Principal.Anonymous(); + } + else + { + SubjectPublicKeyInfo publicKey = identity.GetPublicKey(); + principal = publicKey.ToPrincipal(); + } + TRequest request = getRequest(principal, ICTimestamp.Future(TimeSpan.FromMinutes(3))); + + if (identity == null) + { + var sha256 = SHA256HashFunction.Create(); + RequestId requestId = RequestId.FromObject(request.BuildHashableItem(), sha256); + return new SignedContent(requestId, request, null, null, null); + } + return identity.SignContent(request); + + } } } diff --git a/src/Agent/Identities/IIdentity.cs b/src/Agent/Identities/IIdentity.cs index 783d3d97..47656f86 100644 --- a/src/Agent/Identities/IIdentity.cs +++ b/src/Agent/Identities/IIdentity.cs @@ -38,28 +38,24 @@ public interface IIdentity /// The byte data to sign /// The signature bytes of the specified data bytes public byte[] Sign(byte[] data); - } - /// - /// Extension methods for the IIdentity interface - /// - public static class IIdentityExtensions - { + /// /// Signs the hashable content /// - /// The identity to sign the content with /// The data that needs to be signed /// The content with signature(s) from the identity - public static SignedContent SignContent(this IIdentity identity, Dictionary content) + public SignedContent SignContent(TRequest content) + where TRequest : IRepresentationIndependentHashItem { - SubjectPublicKeyInfo senderPublicKey = identity.GetPublicKey(); + SubjectPublicKeyInfo senderPublicKey = this.GetPublicKey(); var sha256 = SHA256HashFunction.Create(); - byte[] contentHash = content.ToHashable().ComputeHash(sha256); + byte[] contentHash = content.BuildHashableItem().ToHashable().ComputeHash(sha256); + RequestId requestId = RequestId.FromBytes(contentHash); byte[] domainSeparator = Encoding.UTF8.GetBytes("\x0Aic-request"); - byte[] senderSignature = identity.Sign(domainSeparator.Concat(contentHash).ToArray()); - List? senderDelegations = identity.GetSenderDelegations(); - return new SignedContent(content, senderPublicKey, senderDelegations, senderSignature); + byte[] senderSignature = this.Sign(domainSeparator.Concat(contentHash).ToArray()); + List? senderDelegations = this.GetSenderDelegations(); + return new SignedContent(requestId, content, senderPublicKey, senderDelegations, senderSignature); } } -} \ No newline at end of file +} diff --git a/src/Agent/Models/Certificate.cs b/src/Agent/Models/Certificate.cs index 256a5f1e..c1bed509 100644 --- a/src/Agent/Models/Certificate.cs +++ b/src/Agent/Models/Certificate.cs @@ -47,7 +47,7 @@ public Certificate(HashTree tree, byte[] signature, CertificateDelegation? deleg /// BLS crytography implementation to verify signature /// The root public key (DER encoded) of the internet computer network /// True if the certificate is valid, otherwise false - public bool IsValid(IBlsCryptography bls, SubjectPublicKeyInfo rootPublicKey) + public bool IsValid( SubjectPublicKeyInfo rootPublicKey) { /* verify_cert(cert) = @@ -61,14 +61,14 @@ public bool IsValid(IBlsCryptography bls, SubjectPublicKeyInfo rootPublicKey) if (this.Delegation != null) { // override the root key to the delegated one - if (!this.Delegation.Certificate.IsValid(bls, rootPublicKey)) + if (!this.Delegation.Certificate.IsValid(rootPublicKey)) { // If delegation is not valid, then the cert is also not valid return false; } rootPublicKey = this.Delegation.GetPublicKey(); } - return bls.VerifySignature(rootPublicKey.PublicKey, rootHash, this.Signature); + return DefaultBlsCryptograhy.VerifySignature(rootPublicKey.PublicKey, rootHash, this.Signature); } internal static Certificate FromCbor(CborReader reader) diff --git a/src/Agent/Models/SignedContent.cs b/src/Agent/Models/SignedContent.cs index ec9dbbb3..f9241fac 100644 --- a/src/Agent/Models/SignedContent.cs +++ b/src/Agent/Models/SignedContent.cs @@ -9,12 +9,18 @@ namespace EdjCase.ICP.Agent.Models /// /// A model containing content and the signature information of it /// - public class SignedContent : IRepresentationIndependentHashItem + public class SignedContent : IRepresentationIndependentHashItem + where TRequest : IRepresentationIndependentHashItem { /// - /// The content that is signed in the form of key value pairs + /// The hash of the content used for request identification /// - public Dictionary Content { get; } + public RequestId RequestId { get; } + + /// + /// The request that is signed + /// + public TRequest Request { get; } /// /// Public key used to authenticate this request, unless anonymous, then null @@ -32,19 +38,22 @@ public class SignedContent : IRepresentationIndependentHashItem /// public byte[]? SenderSignature { get; } - /// The content that is signed in the form of key value pairs + /// The hash of the content used for request identification + /// The content that is signed in the form of key value pairs /// Public key used to authenticate this request, unless anonymous, then null /// Optional. A chain of delegations, starting with the one signed by sender_pubkey /// and ending with the one delegating to the key relating to sender_sig. /// Signature to authenticate this request, unless anonymous, then null public SignedContent( - Dictionary content, + RequestId requestId, + TRequest request, SubjectPublicKeyInfo? senderPublicKey, List? delegations, byte[]? senderSignature ) { - this.Content = content ?? throw new ArgumentNullException(nameof(content)); + this.RequestId = requestId ?? throw new ArgumentNullException(nameof(requestId)); + this.Request = request ?? throw new ArgumentNullException(nameof(request)); this.SenderPublicKey = senderPublicKey; this.SenderDelegations = delegations; this.SenderSignature = senderSignature; @@ -55,7 +64,7 @@ public Dictionary BuildHashableItem() { var properties = new Dictionary { - {Properties.CONTENT, this.Content.ToHashable()} + {Properties.CONTENT, this.Request.BuildHashableItem().ToHashable()} }; if (this.SenderPublicKey != null) { @@ -72,12 +81,16 @@ public Dictionary BuildHashableItem() return properties; } - internal void WriteCbor(CborWriter writer) + + public byte[] ToCborBytes() { + CborWriter writer = new (); + writer.WriteTag(CborTag.SelfDescribeCbor); writer.WriteStartMap(null); writer.WriteTextString(Properties.CONTENT); - writer.WriteStartMap(this.Content.Count); - foreach ((string key, IHashable value) in this.Content) + Dictionary hashableContent = this.Request.BuildHashableItem(); + writer.WriteStartMap(hashableContent.Count); + foreach ((string key, IHashable value) in hashableContent) { writer.WriteTextString(key); writer.WriteHashableValue(value); @@ -104,6 +117,7 @@ internal void WriteCbor(CborWriter writer) writer.WriteByteString(this.SenderSignature); } writer.WriteEndMap(); + return writer.Encode(); } internal class Properties diff --git a/src/Agent/Requests/CallRequest.cs b/src/Agent/Requests/CallRequest.cs index 4186a90d..73768632 100644 --- a/src/Agent/Requests/CallRequest.cs +++ b/src/Agent/Requests/CallRequest.cs @@ -31,7 +31,7 @@ public class CallRequest : IRepresentationIndependentHashItem /// public ICTimestamp IngressExpiry { get; } /// - /// Optional. Arbitrary user-provided data, typically randomly generated. This can be used to create distinct requests with otherwise identical fields. + /// Optional. If specified will make the request unique even with the same arguments. /// public byte[]? Nonce { get; } @@ -40,7 +40,7 @@ public class CallRequest : IRepresentationIndependentHashItem /// Argument to pass to the canister method /// The user who issued the request /// An upper limit on the validity of the request, expressed in nanoseconds since 1970-01-01 - /// Optional. Arbitrary user-provided data, typically randomly generated. This can be used to create distinct requests with otherwise identical fields. + /// Optional. If specified will make the request unique even with the same arguments public CallRequest( Principal canisterId, string method, @@ -116,4 +116,4 @@ private static class Properties public const string NONCE = "nonce"; } } -} \ No newline at end of file +} diff --git a/src/Agent/Requests/QueryRequest.cs b/src/Agent/Requests/QueryRequest.cs index b7418c8f..eccc18ce 100644 --- a/src/Agent/Requests/QueryRequest.cs +++ b/src/Agent/Requests/QueryRequest.cs @@ -41,8 +41,7 @@ public class QueryRequest : IRepresentationIndependentHashItem public ICTimestamp IngressExpiry { get; } /// - /// Optional. Arbitrary user-provided data, typically randomly generated. - /// This can be used to create distinct requests with otherwise identical fields. + /// Optional. If specified will make the request unique even with the same arguments /// public byte[]? Nonce { get; } @@ -51,12 +50,14 @@ public class QueryRequest : IRepresentationIndependentHashItem /// Arguments to pass to the canister method /// The user who issued the request /// The expiration of the request to avoid replay attacks + /// Optional. If specified will make the request unique even with the same arguments public QueryRequest( Principal canisterId, string method, CandidArg arg, Principal sender, - ICTimestamp ingressExpiry + ICTimestamp ingressExpiry, + byte[]? nonce = null ) { this.CanisterId = canisterId ?? throw new ArgumentNullException(nameof(canisterId)); @@ -64,6 +65,7 @@ ICTimestamp ingressExpiry this.Arg = arg ?? throw new ArgumentNullException(nameof(arg)); this.Sender = sender ?? throw new ArgumentNullException(nameof(sender)); this.IngressExpiry = ingressExpiry ?? throw new ArgumentNullException(nameof(ingressExpiry)); + this.Nonce = nonce ?? throw new ArgumentNullException(nameof(nonce)); } /// @@ -128,4 +130,4 @@ private static class Properties public const string NONCE = "nonce"; } } -} \ No newline at end of file +} diff --git a/src/BLS/API.xml b/src/BLS/API.xml index dabc0304..1b632b52 100644 --- a/src/BLS/API.xml +++ b/src/BLS/API.xml @@ -4,15 +4,6 @@ EdjCase.ICP.BLS - - - Bls cryptography class that AWLAYS returns TRUE. This is intended only for - development scenarios and is never recommended - - - - - Represents the default implementation of the IBlsCryptography interface for BLS cryptography. @@ -21,19 +12,5 @@ - - - An interface for all BLS crytography operations - - - - - Verifies a BLS signature (ICP flavor only) - - The signer public key - The SHA256 hash of the message - The signature of the message - True if the signature is valid, otherwise false - diff --git a/src/BLS/BypassedBlsCryptography.cs b/src/BLS/BypassedBlsCryptography.cs deleted file mode 100644 index f8832ead..00000000 --- a/src/BLS/BypassedBlsCryptography.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace EdjCase.ICP.BLS -{ - /// - /// Bls cryptography class that AWLAYS returns TRUE. This is intended only for - /// development scenarios and is never recommended - /// - public class BypassedBlsCryptography : IBlsCryptography - { - /// - public bool VerifySignature(byte[] publicKey, byte[] messageHash, byte[] signature) - { - return true; - } - } -} diff --git a/src/BLS/DefaultBlsCryptograhy.cs b/src/BLS/DefaultBlsCryptograhy.cs index c182e8aa..873a2446 100644 --- a/src/BLS/DefaultBlsCryptograhy.cs +++ b/src/BLS/DefaultBlsCryptograhy.cs @@ -12,7 +12,7 @@ namespace EdjCase.ICP.BLS /// /// Represents the default implementation of the IBlsCryptography interface for BLS cryptography. /// - public class DefaultBlsCryptograhy : IBlsCryptography + internal static class DefaultBlsCryptograhy { internal static readonly byte[] DomainSeperator; @@ -22,7 +22,7 @@ static DefaultBlsCryptograhy() } /// - public bool VerifySignature(byte[] publicKey, byte[] messageHash, byte[] signature) + public static bool VerifySignature(byte[] publicKey, byte[] messageHash, byte[] signature) { G1Affine sig = G1Affine.FromCompressed(signature); G2Prepared g2Gen = G2Affine.Generator().Neg().ToProjective().ToPrepared(); @@ -34,10 +34,10 @@ public bool VerifySignature(byte[] publicKey, byte[] messageHash, byte[] signatu (sig, g2Gen), (msg, pk) }; - return this.VerifyInternal(pairs); + return VerifyInternal(pairs); } - private bool VerifyInternal( + private static bool VerifyInternal( (G1Affine G1, G2Prepared G2)[] pairs ) { diff --git a/src/BLS/IBlsCryptography.cs b/src/BLS/IBlsCryptography.cs deleted file mode 100644 index 9ecb96e9..00000000 --- a/src/BLS/IBlsCryptography.cs +++ /dev/null @@ -1,26 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace EdjCase.ICP.BLS -{ - /// - /// An interface for all BLS crytography operations - /// - public interface IBlsCryptography - { - - /// - /// Verifies a BLS signature (ICP flavor only) - /// - /// The signer public key - /// The SHA256 hash of the message - /// The signature of the message - /// True if the signature is valid, otherwise false - bool VerifySignature( - byte[] publicKey, - byte[] messageHash, - byte[] signature - ); - } -} diff --git a/src/BLS/Properties/AssemblyInfo.cs b/src/BLS/Properties/AssemblyInfo.cs index 265facf3..d25d2a15 100644 --- a/src/BLS/Properties/AssemblyInfo.cs +++ b/src/BLS/Properties/AssemblyInfo.cs @@ -3,3 +3,4 @@ [assembly: InternalsVisibleTo("BLS.Tests")] [assembly: InternalsVisibleTo("Performance.Tests")] [assembly: InternalsVisibleTo("Sample.CLI")] +[assembly: InternalsVisibleTo("EdjCase.ICP.Agent")] diff --git a/src/Candid/API.xml b/src/Candid/API.xml index f0be53ef..869ccdd8 100644 --- a/src/Candid/API.xml +++ b/src/Candid/API.xml @@ -1901,11 +1901,11 @@ Raw request id bytes A request id object - + Converts a hashable object into a request id - The properties of the object to hash + The object to hash The hash function to use to generate the hash A request id object diff --git a/src/Candid/Models/IHashable.cs b/src/Candid/Models/IHashable.cs index b82007fc..98c148fb 100644 --- a/src/Candid/Models/IHashable.cs +++ b/src/Candid/Models/IHashable.cs @@ -190,4 +190,4 @@ public static HashableObject ToHashable(this Dictionary value) return new HashableObject(value.ToDictionary(v => v.Key, v => (IHashable)v.Value)); } } -} \ No newline at end of file +} diff --git a/src/Candid/Models/RequestId.cs b/src/Candid/Models/RequestId.cs index 83a80f2b..afe02fb6 100644 --- a/src/Candid/Models/RequestId.cs +++ b/src/Candid/Models/RequestId.cs @@ -34,12 +34,12 @@ public static RequestId FromBytes(byte[] bytes) /// /// Converts a hashable object into a request id /// - /// The properties of the object to hash + /// The object to hash /// The hash function to use to generate the hash /// A request id object - public static RequestId FromObject(IDictionary properties, IHashFunction hashFunction) + public static RequestId FromObject(Dictionary item, IHashFunction hashFunction) { - var orderedProperties = properties + byte[] bytes = item .Where(o => o.Value != null) // Remove empty/null ones .Select(o => { @@ -48,8 +48,7 @@ public static RequestId FromObject(IDictionary properties, IH return (KeyHash: keyDigest, ValueHash: valueDigest); }) // Hash key and value bytes - .OrderBy(o => o.KeyHash, new HashComparer()); // Keys in order - byte[] bytes = orderedProperties + .OrderBy(o => o.KeyHash, new HashComparer()) // Keys in order .SelectMany(o => o.KeyHash.Concat(o.ValueHash)) .ToArray(); // Create single byte[] by concatinating them all together return new RequestId(hashFunction.ComputeHash(bytes)); diff --git a/test/BLS.Tests/DefaultBlsCryptographyTests.cs b/test/BLS.Tests/DefaultBlsCryptographyTests.cs index 3de8ce03..20012345 100644 --- a/test/BLS.Tests/DefaultBlsCryptographyTests.cs +++ b/test/BLS.Tests/DefaultBlsCryptographyTests.cs @@ -25,7 +25,7 @@ public void VerifySignature(string publicKeyHex, string msgHex, string signature byte[] msg = ByteUtil.FromHexString(msgHex); byte[] signature = ByteUtil.FromHexString(signatureHex); - bool isValid = new DefaultBlsCryptograhy().VerifySignature(publicKey, msg, signature); + bool isValid = DefaultBlsCryptograhy.VerifySignature(publicKey, msg, signature); Assert.True(isValid); } @@ -46,7 +46,7 @@ public void VerifySignature__Invalid(string publicKeyHex, string msgHex, string byte[] msg = ByteUtil.FromHexString(msgHex); byte[] signature = ByteUtil.FromHexString(signatureHex); - bool isValid = new DefaultBlsCryptograhy().VerifySignature(publicKey, msg, signature); + bool isValid = DefaultBlsCryptograhy.VerifySignature(publicKey, msg, signature); Assert.False(isValid); } From 2038c05faa1409919f35264688f51a3679520b44 Mon Sep 17 00:00:00 2001 From: Gekctek Date: Wed, 5 Mar 2025 21:32:04 -0800 Subject: [PATCH 02/20] Changing QueryAsync return type and auto throwing error --- .../Client/Pages/Index.razor | 666 +++++++++--------- samples/Sample.CLI/Program.cs | 4 +- samples/Sample.PocketIC/PocketIc.Tests.cs | 9 +- samples/Sample.Shared/Dex/DexApiClient.cs | 12 +- .../Governance/GovernanceApiClient.cs | 51 +- .../ICRC1Ledger/ICRC1LedgerApiClient.cs | 39 +- src/Agent/API.xml | 209 +++--- src/Agent/Agents/HttpAgent.cs | 6 +- src/Agent/Agents/IAgent.cs | 70 +- src/Agent/Models/SignedContent.cs | 9 +- .../AssetCanister/AssetCanisterApiClient.cs | 18 +- src/Agent/Standards/ICRC1/ICRC1Client.cs | 29 +- src/ClientGenerator/ClientCodeGenerator.cs | 2 +- src/PocketIC/API.xml | 3 +- src/PocketIC/PocketIc.cs | 6 +- src/WebSockets/API.xml | 7 - src/WebSockets/WebSocketAgent.cs | 9 +- src/WebSockets/WebSocketBuilder.cs | 17 - ...ies_False_OverrideOptionalValue_False.snap | 6 +- ...ties_False_OverrideOptionalValue_True.snap | 6 +- ...ties_True_OverrideOptionalValue_False.snap | 6 +- ...rties_True_OverrideOptionalValue_True.snap | 6 +- ...ies_False_OverrideOptionalValue_False.snap | 6 +- ...ties_False_OverrideOptionalValue_True.snap | 6 +- ...ties_True_OverrideOptionalValue_False.snap | 6 +- ...rties_True_OverrideOptionalValue_True.snap | 6 +- ...ies_False_OverrideOptionalValue_False.snap | 6 +- ...ties_False_OverrideOptionalValue_True.snap | 6 +- ...ties_True_OverrideOptionalValue_False.snap | 6 +- ...rties_True_OverrideOptionalValue_True.snap | 6 +- ...ies_False_OverrideOptionalValue_False.snap | 6 +- ...ties_False_OverrideOptionalValue_True.snap | 6 +- ...ties_True_OverrideOptionalValue_False.snap | 6 +- ...rties_True_OverrideOptionalValue_True.snap | 6 +- ...ies_False_OverrideOptionalValue_False.snap | 6 +- ...ties_False_OverrideOptionalValue_True.snap | 6 +- ...ties_True_OverrideOptionalValue_False.snap | 6 +- ...rties_True_OverrideOptionalValue_True.snap | 6 +- ...ies_False_OverrideOptionalValue_False.snap | 6 +- ...ties_False_OverrideOptionalValue_True.snap | 6 +- ...ties_True_OverrideOptionalValue_False.snap | 6 +- ...rties_True_OverrideOptionalValue_True.snap | 6 +- ...ies_False_OverrideOptionalValue_False.snap | 6 +- ...ties_False_OverrideOptionalValue_True.snap | 6 +- ...ties_True_OverrideOptionalValue_False.snap | 6 +- ...rties_True_OverrideOptionalValue_True.snap | 6 +- ...ies_False_OverrideOptionalValue_False.snap | 6 +- ...ties_False_OverrideOptionalValue_True.snap | 6 +- ...ties_True_OverrideOptionalValue_False.snap | 6 +- ...rties_True_OverrideOptionalValue_True.snap | 6 +- ...ies_False_OverrideOptionalValue_False.snap | 12 +- ...ties_False_OverrideOptionalValue_True.snap | 12 +- ...ties_True_OverrideOptionalValue_False.snap | 12 +- ...rties_True_OverrideOptionalValue_True.snap | 12 +- ...ies_False_OverrideOptionalValue_False.snap | 12 +- ...ties_False_OverrideOptionalValue_True.snap | 12 +- ...ties_True_OverrideOptionalValue_False.snap | 12 +- ...rties_True_OverrideOptionalValue_True.snap | 12 +- ...ies_False_OverrideOptionalValue_False.snap | 12 +- ...ties_False_OverrideOptionalValue_True.snap | 12 +- ...ties_True_OverrideOptionalValue_False.snap | 12 +- ...rties_True_OverrideOptionalValue_True.snap | 12 +- ...ies_False_OverrideOptionalValue_False.snap | 12 +- ...ties_False_OverrideOptionalValue_True.snap | 12 +- ...ties_True_OverrideOptionalValue_False.snap | 12 +- ...rties_True_OverrideOptionalValue_True.snap | 12 +- ...ies_False_OverrideOptionalValue_False.snap | 12 +- ...ties_False_OverrideOptionalValue_True.snap | 12 +- ...ties_True_OverrideOptionalValue_False.snap | 12 +- ...rties_True_OverrideOptionalValue_True.snap | 12 +- ...ies_False_OverrideOptionalValue_False.snap | 12 +- ...ties_False_OverrideOptionalValue_True.snap | 12 +- ...ties_True_OverrideOptionalValue_False.snap | 12 +- ...rties_True_OverrideOptionalValue_True.snap | 12 +- ...ies_False_OverrideOptionalValue_False.snap | 12 +- ...ties_False_OverrideOptionalValue_True.snap | 12 +- ...ties_True_OverrideOptionalValue_False.snap | 12 +- ...rties_True_OverrideOptionalValue_True.snap | 12 +- ...ies_False_OverrideOptionalValue_False.snap | 12 +- ...ties_False_OverrideOptionalValue_True.snap | 12 +- ...ties_True_OverrideOptionalValue_False.snap | 12 +- ...rties_True_OverrideOptionalValue_True.snap | 12 +- ...ies_False_OverrideOptionalValue_False.snap | 3 +- ...ties_False_OverrideOptionalValue_True.snap | 3 +- ...ties_True_OverrideOptionalValue_False.snap | 3 +- ...rties_True_OverrideOptionalValue_True.snap | 3 +- ...ies_False_OverrideOptionalValue_False.snap | 3 +- ...ties_False_OverrideOptionalValue_True.snap | 3 +- ...ties_True_OverrideOptionalValue_False.snap | 3 +- ...rties_True_OverrideOptionalValue_True.snap | 3 +- ...ies_False_OverrideOptionalValue_False.snap | 3 +- ...ties_False_OverrideOptionalValue_True.snap | 3 +- ...ties_True_OverrideOptionalValue_False.snap | 3 +- ...rties_True_OverrideOptionalValue_True.snap | 3 +- ...ies_False_OverrideOptionalValue_False.snap | 3 +- ...ties_False_OverrideOptionalValue_True.snap | 3 +- ...ties_True_OverrideOptionalValue_False.snap | 3 +- ...rties_True_OverrideOptionalValue_True.snap | 3 +- ...ies_False_OverrideOptionalValue_False.snap | 3 +- ...ties_False_OverrideOptionalValue_True.snap | 3 +- ...ties_True_OverrideOptionalValue_False.snap | 3 +- ...rties_True_OverrideOptionalValue_True.snap | 3 +- ...ies_False_OverrideOptionalValue_False.snap | 3 +- ...ties_False_OverrideOptionalValue_True.snap | 3 +- ...ties_True_OverrideOptionalValue_False.snap | 3 +- ...rties_True_OverrideOptionalValue_True.snap | 3 +- ...ies_False_OverrideOptionalValue_False.snap | 3 +- ...ties_False_OverrideOptionalValue_True.snap | 3 +- ...ties_True_OverrideOptionalValue_False.snap | 3 +- ...rties_True_OverrideOptionalValue_True.snap | 3 +- ...ies_False_OverrideOptionalValue_False.snap | 3 +- ...ties_False_OverrideOptionalValue_True.snap | 3 +- ...ties_True_OverrideOptionalValue_False.snap | 3 +- ...rties_True_OverrideOptionalValue_True.snap | 3 +- ...ies_False_OverrideOptionalValue_False.snap | 3 +- ...ties_False_OverrideOptionalValue_True.snap | 3 +- ...ties_True_OverrideOptionalValue_False.snap | 3 +- ...rties_True_OverrideOptionalValue_True.snap | 3 +- ...ies_False_OverrideOptionalValue_False.snap | 3 +- ...ties_False_OverrideOptionalValue_True.snap | 3 +- ...ties_True_OverrideOptionalValue_False.snap | 3 +- ...rties_True_OverrideOptionalValue_True.snap | 3 +- ...ies_False_OverrideOptionalValue_False.snap | 3 +- ...ties_False_OverrideOptionalValue_True.snap | 3 +- ...ties_True_OverrideOptionalValue_False.snap | 3 +- ...rties_True_OverrideOptionalValue_True.snap | 3 +- ...ies_False_OverrideOptionalValue_False.snap | 3 +- ...ties_False_OverrideOptionalValue_True.snap | 3 +- ...ties_True_OverrideOptionalValue_False.snap | 3 +- ...rties_True_OverrideOptionalValue_True.snap | 3 +- ...ies_False_OverrideOptionalValue_False.snap | 3 +- ...ties_False_OverrideOptionalValue_True.snap | 3 +- ...ties_True_OverrideOptionalValue_False.snap | 3 +- ...rties_True_OverrideOptionalValue_True.snap | 3 +- ...ies_False_OverrideOptionalValue_False.snap | 3 +- ...ties_False_OverrideOptionalValue_True.snap | 3 +- ...ties_True_OverrideOptionalValue_False.snap | 3 +- ...rties_True_OverrideOptionalValue_True.snap | 3 +- ...ies_False_OverrideOptionalValue_False.snap | 3 +- ...ties_False_OverrideOptionalValue_True.snap | 3 +- ...ties_True_OverrideOptionalValue_False.snap | 3 +- ...rties_True_OverrideOptionalValue_True.snap | 3 +- ...ies_False_OverrideOptionalValue_False.snap | 3 +- ...ties_False_OverrideOptionalValue_True.snap | 3 +- ...ties_True_OverrideOptionalValue_False.snap | 3 +- ...rties_True_OverrideOptionalValue_True.snap | 3 +- ...ies_False_OverrideOptionalValue_False.snap | 42 +- ...ties_False_OverrideOptionalValue_True.snap | 42 +- ...ties_True_OverrideOptionalValue_False.snap | 42 +- ...rties_True_OverrideOptionalValue_True.snap | 42 +- ...ies_False_OverrideOptionalValue_False.snap | 42 +- ...ties_False_OverrideOptionalValue_True.snap | 42 +- ...ties_True_OverrideOptionalValue_False.snap | 42 +- ...rties_True_OverrideOptionalValue_True.snap | 42 +- ...ies_False_OverrideOptionalValue_False.snap | 42 +- ...ties_False_OverrideOptionalValue_True.snap | 42 +- ...ties_True_OverrideOptionalValue_False.snap | 42 +- ...rties_True_OverrideOptionalValue_True.snap | 42 +- ...ies_False_OverrideOptionalValue_False.snap | 42 +- ...ties_False_OverrideOptionalValue_True.snap | 42 +- ...ties_True_OverrideOptionalValue_False.snap | 42 +- ...rties_True_OverrideOptionalValue_True.snap | 42 +- ...ies_False_OverrideOptionalValue_False.snap | 42 +- ...ties_False_OverrideOptionalValue_True.snap | 42 +- ...ties_True_OverrideOptionalValue_False.snap | 42 +- ...rties_True_OverrideOptionalValue_True.snap | 42 +- ...ies_False_OverrideOptionalValue_False.snap | 42 +- ...ties_False_OverrideOptionalValue_True.snap | 42 +- ...ties_True_OverrideOptionalValue_False.snap | 42 +- ...rties_True_OverrideOptionalValue_True.snap | 42 +- ...ies_False_OverrideOptionalValue_False.snap | 42 +- ...ties_False_OverrideOptionalValue_True.snap | 42 +- ...ties_True_OverrideOptionalValue_False.snap | 42 +- ...rties_True_OverrideOptionalValue_True.snap | 42 +- ...ies_False_OverrideOptionalValue_False.snap | 42 +- ...ties_False_OverrideOptionalValue_True.snap | 42 +- ...ties_True_OverrideOptionalValue_False.snap | 42 +- ...rties_True_OverrideOptionalValue_True.snap | 42 +- test/Candid.Tests/SigningTests.cs | 5 +- .../Benchmarks/SignatureBenchmarks.cs | 4 +- test/PocketIC.Tests/PocketIc.Tests.cs | 6 +- test/WebSockets.Tests/WebSocketsAgentTests.cs | 10 - 182 files changed, 1250 insertions(+), 2053 deletions(-) diff --git a/samples/Sample.BlazorWebAssembly/Client/Pages/Index.razor b/samples/Sample.BlazorWebAssembly/Client/Pages/Index.razor index db6762c8..0e100ba7 100644 --- a/samples/Sample.BlazorWebAssembly/Client/Pages/Index.razor +++ b/samples/Sample.BlazorWebAssembly/Client/Pages/Index.razor @@ -1,335 +1,335 @@ -@page "/" -@using EdjCase.ICP.Agent -@using EdjCase.ICP.Agent.Models -@using EdjCase.ICP.Agent.Identities -@using EdjCase.ICP.Candid.Models -@using System.Text.Json.Serialization -@using EdjCase.ICP.Candid.Utilities - -@inject IJSRuntime JSRuntime -@inject Sample.Shared.Governance.GovernanceApiClient Client -@inject System.Net.Http.HttpClient Http - - -Get Proposal Info - -

Get Proposal Info

- - - - - -@if (this.Client.Agent.Identity == null) -{ - -} -else -{ - -} -@if (this.Info?.HasValue == true) -{ - ProposalInfo info = this.Info.GetValueOrThrow(); -

Id: @info.Id.GetValueOrDefault()?.Id

-

Status: @info.Status

-

Topic: @info.Topic

- if (info.LatestTally.HasValue) - { - Tally latestTally = info.LatestTally.GetValueOrThrow(); -

Votes

-
    -
  • Yes: @latestTally.Yes
  • -
  • No: @latestTally.No
  • -
  • Total: @latestTally.Total
  • -
- } - if (info.Proposal.HasValue) - { - Proposal proposal = info.Proposal.GetValueOrThrow(); -

Proposal

-

Title: @proposal.Title

-

Summary: @proposal.Summary

-

Url: @proposal.Url

- if (proposal.Action.HasValue) - { - var action = proposal.Action.GetValueOrThrow(); - switch (action.Tag) - { - case ActionTag.Motion: -

Motion: @action.AsMotion().MotionText

- break; - } - } - } -
-        @JsonSerializer.Serialize(info, new JsonSerializerOptions{WriteIndented=true});
-            
- -} -else if (this.MadeCall && this.ProposalId != null) -{ -

Id: @this.ProposalId

-

Proposal Not Found

-} - -@code { - public ulong? ProposalId { get; set; } - public bool MadeCall { get; set; } - public OptionalValue? Info { get; set; } - - public async Task ReloadProposalInfo() - { - if (this.ProposalId != null) - { - this.Info = await this.Client.GetProposalInfo(this.ProposalId.Value); - this.MadeCall = true; - } - } - - public async Task Login() - { - var dotNetReference = DotNetObjectReference.Create(this); - await JSRuntime.InvokeVoidAsync("window.authClientLogin", dotNetReference); - } - - public async Task Logout() - { - await JSRuntime.InvokeVoidAsync("window.authClientLogout"); - this.StateHasChanged(); - } - - protected override async Task OnInitializedAsync() - { - await this.SetIdentityAsync(); - } - - [JSInvokable("OnLoginSuccess")] // This is required in order to JS be able to execute it - public async Task OnLoginSuccessAsync() - { - await this.SetIdentityAsync(); - - } - - public async Task SetIdentityAsync() - { - List? identityValues = await this.GetLocalStorageValueAsync>("ic-identity"); - DelegationChainModel? chainModel = await this.GetLocalStorageValueAsync("ic-delegation"); - if (identityValues != null && chainModel != null) - { +@page "/" +@using EdjCase.ICP.Agent +@using EdjCase.ICP.Agent.Models +@using EdjCase.ICP.Agent.Identities +@using EdjCase.ICP.Candid.Models +@using System.Text.Json.Serialization +@using EdjCase.ICP.Candid.Utilities + +@inject IJSRuntime JSRuntime +@inject Sample.Shared.Governance.GovernanceApiClient Client +@inject System.Net.Http.HttpClient Http + + +Get Proposal Info + +

Get Proposal Info

+ + + + + +@if (this.Client.Identity == null) +{ + +} +else +{ + +} +@if (this.Info?.HasValue == true) +{ + ProposalInfo info = this.Info.GetValueOrThrow(); +

Id: @info.Id.GetValueOrDefault()?.Id

+

Status: @info.Status

+

Topic: @info.Topic

+ if (info.LatestTally.HasValue) + { + Tally latestTally = info.LatestTally.GetValueOrThrow(); +

Votes

+
    +
  • Yes: @latestTally.Yes
  • +
  • No: @latestTally.No
  • +
  • Total: @latestTally.Total
  • +
+ } + if (info.Proposal.HasValue) + { + Proposal proposal = info.Proposal.GetValueOrThrow(); +

Proposal

+

Title: @proposal.Title

+

Summary: @proposal.Summary

+

Url: @proposal.Url

+ if (proposal.Action.HasValue) + { + var action = proposal.Action.GetValueOrThrow(); + switch (action.Tag) + { + case ActionTag.Motion: +

Motion: @action.AsMotion().MotionText

+ break; + } + } + } +
+        @JsonSerializer.Serialize(info, new JsonSerializerOptions{WriteIndented=true});
+            
+ +} +else if (this.MadeCall && this.ProposalId != null) +{ +

Id: @this.ProposalId

+

Proposal Not Found

+} + +@code { + public ulong? ProposalId { get; set; } + public bool MadeCall { get; set; } + public OptionalValue? Info { get; set; } + + public async Task ReloadProposalInfo() + { + if (this.ProposalId != null) + { + this.Info = await this.Client.GetProposalInfo(this.ProposalId.Value); + this.MadeCall = true; + } + } + + public async Task Login() + { + var dotNetReference = DotNetObjectReference.Create(this); + await JSRuntime.InvokeVoidAsync("window.authClientLogin", dotNetReference); + } + + public async Task Logout() + { + await JSRuntime.InvokeVoidAsync("window.authClientLogout"); + this.StateHasChanged(); + } + + protected override async Task OnInitializedAsync() + { + await this.SetIdentityAsync(); + } + + [JSInvokable("OnLoginSuccess")] // This is required in order to JS be able to execute it + public async Task OnLoginSuccessAsync() + { + await this.SetIdentityAsync(); + + } + + public async Task SetIdentityAsync() + { + List? identityValues = await this.GetLocalStorageValueAsync>("ic-identity"); + DelegationChainModel? chainModel = await this.GetLocalStorageValueAsync("ic-delegation"); + if (identityValues != null && chainModel != null) + { byte[] privateKey = FromHexString(identityValues[1]); var identity = Ed25519Identity.FromPrivateKey(privateKey); - DelegationChain chain = chainModel.ToCommon(); - this.Client.Agent.Identity = new DelegationIdentity(identity, chain); - } - this.StateHasChanged(); - } - - public static byte[] FromHexString(string hexString) - { - var bytes = new byte[hexString.Length / 2]; - for (var i = 0; i < bytes.Length; i++) - { - bytes[i] = Convert.ToByte(hexString.Substring(i * 2, 2), 16); - } - return bytes; - } - - public async Task GetLocalStorageValueAsync(string key) - { - JsonElement storageJsonElement = await JSRuntime.InvokeAsync("localStorage.getItem", key); - string? json = storageJsonElement.GetString(); - if (json == null) - { - return default; - } - return JsonSerializer.Deserialize(json)!; - } - - public class DelegationChainModel - { - [JsonPropertyName("delegations")] - public List Delegations { get; set; } = new List(); - [JsonPropertyName("publicKey")] - public string PublicKey { get; set; } - - public DelegationChain ToCommon() - { - List delegations = this.Delegations - .Select(d => d.ToCommon()) - .ToList(); - byte[] publicKeyBytes = Convert.FromHexString(this.PublicKey); - SubjectPublicKeyInfo publicKey = SubjectPublicKeyInfo.FromDerEncoding(publicKeyBytes); - return new DelegationChain(publicKey, delegations); - } - } - - public class SignedDelegationModel - { - [JsonPropertyName("delegation")] - public DelegationModel Delegation { get; set; } - [JsonPropertyName("signature")] - public string Signature { get; set; } - - public SignedDelegation ToCommon() - { - Delegation delegation = this.Delegation.ToCommon(); - byte[] signature = Convert.FromHexString(this.Signature); - return new SignedDelegation(delegation, signature); - } - } - - public class DelegationModel - { - [JsonPropertyName("expiration")] - public string Expiration { get; set; } - [JsonPropertyName("pubkey")] - public string PubKey { get; set; } - - public Delegation ToCommon() - { - byte[] publicKeyBytes = Convert.FromHexString(this.PubKey); - SubjectPublicKeyInfo publicKey = SubjectPublicKeyInfo.FromDerEncoding(publicKeyBytes); - ulong nanosecondsFromNow = (ulong)ToBigInteger(FromHexString(this.Expiration), isUnsigned: true, isBigEndian: true); - ICTimestamp expiration = ICTimestamp.FromNanoSeconds(nanosecondsFromNow); - return new Delegation(publicKey, expiration, targets: null); - } - - public static System.Numerics.BigInteger ToBigInteger(byte[] bytes, bool isUnsigned, bool isBigEndian) - { - // BigInteger takes a twos compliment little endian value - if (isUnsigned || isBigEndian) - { - BinarySequence bits = BinarySequence.FromBytes(bytes, isBigEndian); - if (isUnsigned && bits.MostSignificantBit) - { - // Convert unsigned to signed - bits = bits.ToTwosCompliment(); - } - bytes = bits.ToByteArray(bigEndian: false); - } - return new System.Numerics.BigInteger(bytes); - } - - internal class BinarySequence - { - // Least signifcant bit (index 0) => Most signifcant bit (index n - 1) - private readonly bool[] bits; - - public bool MostSignificantBit => this.bits[this.bits.Length - 1]; - - /// Least signifcant to most ordered bits - public BinarySequence(bool[] bits) - { - this.bits = bits; - } - - public BinarySequence ToTwosCompliment() - { - // If value most significant bit is `1`, the 2's compliment needs to be 1 bit larger to hold sign bit - if (this.MostSignificantBit) - { - bool[] newBits = new bool[this.bits.Length + 1]; - this.bits.CopyTo(newBits, 0); - return new BinarySequence(newBits); - } - bool[] bits = this.ToTwosComplimentInternal().ToArray(); - return new BinarySequence(bits); - } - - public BinarySequence ToReverseTwosCompliment() - { - if (this.bits.Last()) - { - throw new InvalidOperationException("Cannot reverse two's compliment on a negative number"); - } - bool[] bits = this.ToTwosComplimentInternal().ToArray(); - return new BinarySequence(bits); - } - - public byte[] ToByteArray(bool bigEndian = false) - { - IEnumerable bytes = this.bits - .Chunk(8) - .Select(BitsToByte); - // Reverse if need big endian - if (bigEndian) - { - bytes = bytes.Reverse(); - } - - return bytes.ToArray(); - - byte BitsToByte(bool[] bits) - { - if (bits.Length > 8) - { - throw new ArgumentException("Bit length must be less than or equal to 8"); - } - // Bits are in least significant first order - int value = 0; - for (int i = 0; i < bits.Length; i++) - { - bool b = bits[i]; - if (b) - { - value |= 1 << i; - } - } - return (byte)value; - } - } - - public override string ToString() - { - var stringBuilder = new System.Text.StringBuilder(); - foreach (bool bit in this.bits.Reverse()) // Reverse to show LSB on right (normal display) - { - stringBuilder.Append(bit ? "1" : "0"); - } - return stringBuilder.ToString(); - } - - public static BinarySequence FromBytes(byte[] bytes, bool isBigEndian) - { - IEnumerable byteSeq = bytes; - if (isBigEndian) - { - byteSeq = byteSeq.Reverse(); - } - bool[] bits = byteSeq - .SelectMany(ByteToBits) - .ToArray(); - return new BinarySequence(bits); - - IEnumerable ByteToBits(byte b) - { - // Least significant first - yield return (b & 0b00000001) == 0b00000001; - yield return (b & 0b00000010) == 0b00000010; - yield return (b & 0b00000100) == 0b00000100; - yield return (b & 0b00001000) == 0b00001000; - yield return (b & 0b00010000) == 0b00010000; - yield return (b & 0b00100000) == 0b00100000; - yield return (b & 0b01000000) == 0b01000000; - yield return (b & 0b10000000) == 0b10000000; - } - } - - private IEnumerable ToTwosComplimentInternal() - { - // Invert all numbers left of the right-most `1` to get 2's compliment - - bool flipBits = false; - foreach (bool bit in this.bits.Reverse()) - { - yield return flipBits ? !bit : bit; - // If bit is `1`, all bits to left are flipped - if (bit) - { - flipBits = true; - } - } - } - } - } -} \ No newline at end of file + DelegationChain chain = chainModel.ToCommon(); + this.Client.Identity = new DelegationIdentity(identity, chain); + } + this.StateHasChanged(); + } + + public static byte[] FromHexString(string hexString) + { + var bytes = new byte[hexString.Length / 2]; + for (var i = 0; i < bytes.Length; i++) + { + bytes[i] = Convert.ToByte(hexString.Substring(i * 2, 2), 16); + } + return bytes; + } + + public async Task GetLocalStorageValueAsync(string key) + { + JsonElement storageJsonElement = await JSRuntime.InvokeAsync("localStorage.getItem", key); + string? json = storageJsonElement.GetString(); + if (json == null) + { + return default; + } + return JsonSerializer.Deserialize(json)!; + } + + public class DelegationChainModel + { + [JsonPropertyName("delegations")] + public List Delegations { get; set; } = new List(); + [JsonPropertyName("publicKey")] + public string PublicKey { get; set; } + + public DelegationChain ToCommon() + { + List delegations = this.Delegations + .Select(d => d.ToCommon()) + .ToList(); + byte[] publicKeyBytes = Convert.FromHexString(this.PublicKey); + SubjectPublicKeyInfo publicKey = SubjectPublicKeyInfo.FromDerEncoding(publicKeyBytes); + return new DelegationChain(publicKey, delegations); + } + } + + public class SignedDelegationModel + { + [JsonPropertyName("delegation")] + public DelegationModel Delegation { get; set; } + [JsonPropertyName("signature")] + public string Signature { get; set; } + + public SignedDelegation ToCommon() + { + Delegation delegation = this.Delegation.ToCommon(); + byte[] signature = Convert.FromHexString(this.Signature); + return new SignedDelegation(delegation, signature); + } + } + + public class DelegationModel + { + [JsonPropertyName("expiration")] + public string Expiration { get; set; } + [JsonPropertyName("pubkey")] + public string PubKey { get; set; } + + public Delegation ToCommon() + { + byte[] publicKeyBytes = Convert.FromHexString(this.PubKey); + SubjectPublicKeyInfo publicKey = SubjectPublicKeyInfo.FromDerEncoding(publicKeyBytes); + ulong nanosecondsFromNow = (ulong)ToBigInteger(FromHexString(this.Expiration), isUnsigned: true, isBigEndian: true); + ICTimestamp expiration = ICTimestamp.FromNanoSeconds(nanosecondsFromNow); + return new Delegation(publicKey, expiration, targets: null); + } + + public static System.Numerics.BigInteger ToBigInteger(byte[] bytes, bool isUnsigned, bool isBigEndian) + { + // BigInteger takes a twos compliment little endian value + if (isUnsigned || isBigEndian) + { + BinarySequence bits = BinarySequence.FromBytes(bytes, isBigEndian); + if (isUnsigned && bits.MostSignificantBit) + { + // Convert unsigned to signed + bits = bits.ToTwosCompliment(); + } + bytes = bits.ToByteArray(bigEndian: false); + } + return new System.Numerics.BigInteger(bytes); + } + + internal class BinarySequence + { + // Least signifcant bit (index 0) => Most signifcant bit (index n - 1) + private readonly bool[] bits; + + public bool MostSignificantBit => this.bits[this.bits.Length - 1]; + + /// Least signifcant to most ordered bits + public BinarySequence(bool[] bits) + { + this.bits = bits; + } + + public BinarySequence ToTwosCompliment() + { + // If value most significant bit is `1`, the 2's compliment needs to be 1 bit larger to hold sign bit + if (this.MostSignificantBit) + { + bool[] newBits = new bool[this.bits.Length + 1]; + this.bits.CopyTo(newBits, 0); + return new BinarySequence(newBits); + } + bool[] bits = this.ToTwosComplimentInternal().ToArray(); + return new BinarySequence(bits); + } + + public BinarySequence ToReverseTwosCompliment() + { + if (this.bits.Last()) + { + throw new InvalidOperationException("Cannot reverse two's compliment on a negative number"); + } + bool[] bits = this.ToTwosComplimentInternal().ToArray(); + return new BinarySequence(bits); + } + + public byte[] ToByteArray(bool bigEndian = false) + { + IEnumerable bytes = this.bits + .Chunk(8) + .Select(BitsToByte); + // Reverse if need big endian + if (bigEndian) + { + bytes = bytes.Reverse(); + } + + return bytes.ToArray(); + + byte BitsToByte(bool[] bits) + { + if (bits.Length > 8) + { + throw new ArgumentException("Bit length must be less than or equal to 8"); + } + // Bits are in least significant first order + int value = 0; + for (int i = 0; i < bits.Length; i++) + { + bool b = bits[i]; + if (b) + { + value |= 1 << i; + } + } + return (byte)value; + } + } + + public override string ToString() + { + var stringBuilder = new System.Text.StringBuilder(); + foreach (bool bit in this.bits.Reverse()) // Reverse to show LSB on right (normal display) + { + stringBuilder.Append(bit ? "1" : "0"); + } + return stringBuilder.ToString(); + } + + public static BinarySequence FromBytes(byte[] bytes, bool isBigEndian) + { + IEnumerable byteSeq = bytes; + if (isBigEndian) + { + byteSeq = byteSeq.Reverse(); + } + bool[] bits = byteSeq + .SelectMany(ByteToBits) + .ToArray(); + return new BinarySequence(bits); + + IEnumerable ByteToBits(byte b) + { + // Least significant first + yield return (b & 0b00000001) == 0b00000001; + yield return (b & 0b00000010) == 0b00000010; + yield return (b & 0b00000100) == 0b00000100; + yield return (b & 0b00001000) == 0b00001000; + yield return (b & 0b00010000) == 0b00010000; + yield return (b & 0b00100000) == 0b00100000; + yield return (b & 0b01000000) == 0b01000000; + yield return (b & 0b10000000) == 0b10000000; + } + } + + private IEnumerable ToTwosComplimentInternal() + { + // Invert all numbers left of the right-most `1` to get 2's compliment + + bool flipBits = false; + foreach (bool bit in this.bits.Reverse()) + { + yield return flipBits ? !bit : bit; + // If bit is `1`, all bits to left are flipped + if (bit) + { + flipBits = true; + } + } + } + } + } +} diff --git a/samples/Sample.CLI/Program.cs b/samples/Sample.CLI/Program.cs index 0eb38642..ad102af1 100644 --- a/samples/Sample.CLI/Program.cs +++ b/samples/Sample.CLI/Program.cs @@ -89,7 +89,7 @@ await result identity = IdentityUtil.FromPemFile(options.IdentityPEMFilePath, options.IdentityPassword); } Uri httpBoundryNodeUrl = new Uri(options.Url!); - var agent = new HttpAgent(identity, httpBoundryNodeUrl); + var agent = new HttpAgent(httpBoundryNodeUrl); Samples s = new(agent); Principal canisterId = Principal.FromText(options.CanisterId!); @@ -111,7 +111,7 @@ await result identity = IdentityUtil.FromPemFile(options.IdentityPEMFilePath, options.IdentityPassword); } Uri httpBoundryNodeUrl = new Uri(options.Url!); - var agent = new HttpAgent(identity, httpBoundryNodeUrl); + var agent = new HttpAgent(httpBoundryNodeUrl); Samples s = new(agent); Principal canisterId = Principal.FromText(options.CanisterId!); diff --git a/samples/Sample.PocketIC/PocketIc.Tests.cs b/samples/Sample.PocketIC/PocketIc.Tests.cs index 8e4f64cc..d371c2f8 100644 --- a/samples/Sample.PocketIC/PocketIc.Tests.cs +++ b/samples/Sample.PocketIC/PocketIc.Tests.cs @@ -117,8 +117,7 @@ public async Task HttpGateway_CounterWasm__Basic__Valid() await using (HttpGateway httpGateway = await pocketIc.RunHttpGatewayAsync()) { HttpAgent agent = httpGateway.BuildHttpAgent(); - QueryResponse getResponse = await agent.QueryAsync(canisterId, "get", CandidArg.Empty()); - CandidArg getResponseArg = getResponse.ThrowOrGetReply(); + CandidArg getResponseArg = await agent.QueryAsync(canisterId, "get", CandidArg.Empty()); UnboundedUInt getResponseValue = getResponseArg.ToObjects(); Assert.Equal((UnboundedUInt)0, getResponseValue); @@ -127,8 +126,7 @@ public async Task HttpGateway_CounterWasm__Basic__Valid() CandidArg incResponseArg = await agent.CallAsync(canisterId, "inc", CandidArg.Empty(), cancellationToken: cts.Token); Assert.Equal(CandidArg.Empty(), incResponseArg); - getResponse = await agent.QueryAsync(canisterId, "get", CandidArg.Empty()); - getResponseArg = getResponse.ThrowOrGetReply(); + getResponseArg = await agent.QueryAsync(canisterId, "get", CandidArg.Empty()); getResponseValue = getResponseArg.ToObjects(); Assert.Equal((UnboundedUInt)1, getResponseValue); @@ -137,8 +135,7 @@ public async Task HttpGateway_CounterWasm__Basic__Valid() CandidArg setResponseArg = await agent.CallAsync(canisterId, "set", setRequestArg, cancellationToken: cts.Token); Assert.Equal(CandidArg.Empty(), setResponseArg); - getResponse = await agent.QueryAsync(canisterId, "get", CandidArg.Empty()); - getResponseArg = getResponse.ThrowOrGetReply(); + getResponseArg = await agent.QueryAsync(canisterId, "get", CandidArg.Empty()); getResponseValue = getResponseArg.ToObjects(); Assert.Equal((UnboundedUInt)10, getResponseValue); diff --git a/samples/Sample.Shared/Dex/DexApiClient.cs b/samples/Sample.Shared/Dex/DexApiClient.cs index 345071cf..43ed1a1b 100644 --- a/samples/Sample.Shared/Dex/DexApiClient.cs +++ b/samples/Sample.Shared/Dex/DexApiClient.cs @@ -54,24 +54,21 @@ public async Task Credit(Principal arg0, Token arg1, UnboundedUInt arg2) public async Task> GetAllBalances() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "getAllBalances", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getAllBalances", arg); return reply.ToObjects>(this.Converter); } public async Task GetBalance(Token arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "getBalance", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalance", arg); return reply.ToObjects(this.Converter); } public async Task> GetBalances() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "getBalances", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalances", arg); return reply.ToObjects>(this.Converter); } @@ -113,8 +110,7 @@ public async Task GetSymbol(Token arg0) public async Task Whoami() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "whoami", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "whoami", arg); return reply.ToObjects(this.Converter); } diff --git a/samples/Sample.Shared/Governance/GovernanceApiClient.cs b/samples/Sample.Shared/Governance/GovernanceApiClient.cs index ebdfc223..e6664433 100644 --- a/samples/Sample.Shared/Governance/GovernanceApiClient.cs +++ b/samples/Sample.Shared/Governance/GovernanceApiClient.cs @@ -40,40 +40,35 @@ public GovernanceApiClient(IAgent agent, Principal canisterId, CandidConverter? public async Task GetBuildMetadata() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_build_metadata", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_build_metadata", arg); return reply.ToObjects(this.Converter); } public async Task GetFullNeuron(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron", arg); return reply.ToObjects(this.Converter); } public async Task GetFullNeuronByIdOrSubaccount(Models.NeuronIdOrSubaccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron_by_id_or_subaccount", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron_by_id_or_subaccount", arg); return reply.ToObjects(this.Converter); } public async Task GetLatestRewardEvent() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_latest_reward_event", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_latest_reward_event", arg); return reply.ToObjects(this.Converter); } public async Task GetMetrics() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_metrics", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_metrics", arg); return reply.ToObjects(this.Converter); } @@ -87,96 +82,84 @@ public async Task GetBuildMetadata() public async Task> GetMostRecentMonthlyNodeProviderRewards() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_most_recent_monthly_node_provider_rewards", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_most_recent_monthly_node_provider_rewards", arg); return reply.ToObjects>(this.Converter); } public async Task GetNetworkEconomicsParameters() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_network_economics_parameters", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_network_economics_parameters", arg); return reply.ToObjects(this.Converter); } public async Task> GetNeuronIds() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_ids", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_ids", arg); return reply.ToObjects>(this.Converter); } public async Task GetNeuronInfo(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info", arg); return reply.ToObjects(this.Converter); } public async Task GetNeuronInfoByIdOrSubaccount(Models.NeuronIdOrSubaccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info_by_id_or_subaccount", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info_by_id_or_subaccount", arg); return reply.ToObjects(this.Converter); } public async Task GetNodeProviderByCaller(NullValue arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_node_provider_by_caller", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_node_provider_by_caller", arg); return reply.ToObjects(this.Converter); } public async Task> GetPendingProposals() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_pending_proposals", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_pending_proposals", arg); return reply.ToObjects>(this.Converter); } public async Task> GetProposalInfo(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_proposal_info", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_proposal_info", arg); return reply.ToObjects>(this.Converter); } public async Task ListKnownNeurons() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_known_neurons", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_known_neurons", arg); return reply.ToObjects(this.Converter); } public async Task ListNeurons(Models.ListNeurons arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_neurons", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_neurons", arg); return reply.ToObjects(this.Converter); } public async Task ListNodeProviders() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_node_providers", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_node_providers", arg); return reply.ToObjects(this.Converter); } public async Task ListProposals(Models.ListProposalInfo arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_proposals", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_proposals", arg); return reply.ToObjects(this.Converter); } diff --git a/samples/Sample.Shared/ICRC1Ledger/ICRC1LedgerApiClient.cs b/samples/Sample.Shared/ICRC1Ledger/ICRC1LedgerApiClient.cs index b142f85d..137c9253 100644 --- a/samples/Sample.Shared/ICRC1Ledger/ICRC1LedgerApiClient.cs +++ b/samples/Sample.Shared/ICRC1Ledger/ICRC1LedgerApiClient.cs @@ -27,88 +27,77 @@ public ICRC1LedgerApiClient(IAgent agent, Principal canisterId, CandidConverter? public async Task GetTransactions(Models.GetTransactionsRequest arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_transactions", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_transactions", arg); return reply.ToObjects(this.Converter); } public async Task GetBlocks(Models.GetBlocksArgs arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_blocks", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_blocks", arg); return reply.ToObjects(this.Converter); } public async Task GetDataCertificate() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_data_certificate", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_data_certificate", arg); return reply.ToObjects(this.Converter); } public async Task Icrc1Name() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "icrc1_name", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "icrc1_name", arg); return reply.ToObjects(this.Converter); } public async Task Icrc1Symbol() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "icrc1_symbol", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "icrc1_symbol", arg); return reply.ToObjects(this.Converter); } public async Task Icrc1Decimals() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "icrc1_decimals", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "icrc1_decimals", arg); return reply.ToObjects(this.Converter); } public async Task> Icrc1Metadata() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "icrc1_metadata", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "icrc1_metadata", arg); return reply.ToObjects>(this.Converter); } public async Task Icrc1TotalSupply() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "icrc1_total_supply", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "icrc1_total_supply", arg); return reply.ToObjects(this.Converter); } public async Task Icrc1Fee() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "icrc1_fee", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "icrc1_fee", arg); return reply.ToObjects(this.Converter); } public async Task> Icrc1MintingAccount() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "icrc1_minting_account", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "icrc1_minting_account", arg); return reply.ToObjects>(this.Converter); } public async Task Icrc1BalanceOf(Models.Account arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "icrc1_balance_of", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "icrc1_balance_of", arg); return reply.ToObjects(this.Converter); } @@ -122,8 +111,7 @@ public async Task Icrc1BalanceOf(Models.Account arg0) public async Task> Icrc1SupportedStandards() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "icrc1_supported_standards", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "icrc1_supported_standards", arg); return reply.ToObjects>(this.Converter); } @@ -137,8 +125,7 @@ public async Task Icrc1BalanceOf(Models.Account arg0) public async Task Icrc2Allowance(Models.AllowanceArgs arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "icrc2_allowance", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "icrc2_allowance", arg); return reply.ToObjects(this.Converter); } diff --git a/src/Agent/API.xml b/src/Agent/API.xml index b32fd7c6..2b87c593 100644 --- a/src/Agent/API.xml +++ b/src/Agent/API.xml @@ -4,6 +4,35 @@ EdjCase.ICP.Agent + + + An `IAgent` implementation using HTTP to make requests to the IC + + + + Optional. Sets the http client to use, otherwise will use the default http client + + + Url to the boundry node to connect to. Defaults to `https://ic0.app/` + + + + + + + + + + + + + + + + + + + The default http client to use with the built in `HttpClient` @@ -72,79 +101,38 @@ - - - An `IAgent` implementation using HTTP to make requests to the IC - - - - - The identity that will be used on each request unless overriden - This identity can be anonymous - - - - Optional. Identity to use for each request. If unspecified, will use anonymous identity - Optional. Bls crypto implementation to validate signatures. If unspecified, will use default implementation - Optional. Sets the http client to use, otherwise will use the default http client - - - Optional. Identity to use for each request. If unspecified, will use anonymous identity - Optional. Bls crypto implementation to validate signatures. If unspecified, will use default implementation - Url to the boundry node to connect to. Defaults to `https://ic0.app/` - - - - - - - - - - - - - - - - - - - - - - An agent is used to communicate with the Internet Computer with certain protocols that are specific to an `IAgent` implementation - + - The identity to use for requests. If null, then it will use the anonymous identity + Gets the status of the IC replica. This includes versioning information + about the replica + A response containing all replica status information - + + + Gets the root public key of the current Internet Computer network + + Optional. Token to cancel request + The root public key bytes + + Gets the state of a specified canister with the subset of state information specified by the paths parameter Canister to read state for The state paths to get information for. Other state data will be pruned if not specified + Optional. Identity to sign the request with Optional. Token to cancel request A response that contains the certificate of the current canister state - - - Gets the status of a request that is being processed by the specified canister - - Canister where the request was sent to - Id of the request to get a status for - Optional. Token to cancel request - A status variant of the request. If request is not found, will return null - - + Sends a call request to a specified canister method and gets the response candid arg back using /v3/../call and falls back to /v2/../call if the v3 is not available @@ -152,86 +140,71 @@ Canister to read state for The name of the method to call on the canister The candid arg to send with the request + Optional. Identity to sign the request with + Optional. If specified will make the request unique even with the same arguments Optional. Specifies the relevant canister id if calling the root canister Optional. Token to cancel request The id of the request that can be used to look up its status with `GetRequestStatusAsync` - - - Sends a call request to a specified canister method and gets back an id of the - request that is being processed using /v2/../call. This call does NOT wait for the request to be complete. - Either check the status with `GetRequestStatusAsync` or use the `CallV2AndWaitAsync` method - - Canister to read state for - The name of the method to call on the canister - The candid arg to send with the request - Optional. Specifies the relevant canister id if calling the root canister - Optional. Token to cancel request - The id of the request that can be used to look up its status with `GetRequestStatusAsync` - - - - Gets the status of the IC replica. This includes versioning information - about the replica - - A response containing all replica status information - - + Sends a query request to a specified canister method Canister to read state for The name of the method to call on the canister The candid arg to send with the request + Optional. If specified will make the request unique even with the same arguments + Optional. Identity to sign the request with + Optional. Specifies the relevant canister id if calling the root canister Optional. Token to cancel request The response data of the query call - + - Gets the root public key of the current Internet Computer network - - Optional. Token to cancel request - The root public key bytes - - - - Extension methods for the `IAgent` interface - - - - - Wrapper to call `CallAsync` (v3/.../call) to avoid breaking auto generated clients - If v2/.../call is wanted, use `CallV2AndWaitAsync` + Sends a call request to a specified canister method and gets back an id of the + request that is being processed using /v2/../call. This call does NOT wait for the request to be complete. + Either check the status with `GetRequestStatusAsync` or use the `CallV2AndWaitAsync` method - The agent to use for the call Canister to read state for The name of the method to call on the canister The candid arg to send with the request + Optional. Identity to sign the request with + Optional. If specified will make the request unique even with the same arguments Optional. Specifies the relevant canister id if calling the root canister Optional. Token to cancel request The id of the request that can be used to look up its status with `GetRequestStatusAsync` - + Sends a call request to a specified canister method, waits for the request to be processed, the returns the candid response to the call. This is helper method built on top of `CallAsynchronousAsync` to wait for the response so it doesn't need to be implemented manually - The agent to use for the call Canister to read state for The name of the method to call on the canister The candid arg to send with the request + Optional. Identity to sign the request with + Optional. If specified will make the request unique even with the same arguments Optional. Specifies the relevant canister id if calling the root canister Optional. Token to cancel request The raw candid arg response - + + + Gets the status of a request that is being processed by the specified canister + + Canister where the request was sent to + Id of the request to get a status for + Optional. Identity to sign the request with + Optional. Token to cancel request + A status variant of the request. If request is not found, will return null + + Waits for a request to be processed and returns the candid response to the call. This is a helper method built on top of `GetRequestStatusAsync` to wait for the response so it doesn't need to be implemented manually - The agent to use for the call Canister to read state for The unique identifier for the request Optional. Token to cancel request @@ -562,16 +535,10 @@ The byte data to sign The signature bytes of the specified data bytes - - - Extension methods for the IIdentity interface - - - + Signs the hashable content - The identity to sign the content with The data that needs to be signed The content with signature(s) from the identity @@ -628,7 +595,7 @@ Optional. A signed delegation that links a public key to the root public key Throws if either `tree` or `signature` are null - + Checks the validity of the certificate based off the specified root public key @@ -742,40 +709,46 @@ Optional. List of pricipals where requests can originate from A delegation chain signed by the delegating identity - + A model containing content and the signature information of it - + + + The hash of the content used for request identification + + + - The content that is signed in the form of key value pairs + The request that is signed - + Public key used to authenticate this request, unless anonymous, then null - + Optional. A chain of delegations, starting with the one signed by sender_pubkey and ending with the one delegating to the key relating to sender_sig. - + Signature to authenticate this request, unless anonymous, then null - - The content that is signed in the form of key value pairs + + The hash of the content used for request identification + The content that is signed in the form of key value pairs Public key used to authenticate this request, unless anonymous, then null Optional. A chain of delegations, starting with the one signed by sender_pubkey and ending with the one delegating to the key relating to sender_sig. Signature to authenticate this request, unless anonymous, then null - + @@ -854,7 +827,7 @@ - Optional. Arbitrary user-provided data, typically randomly generated. This can be used to create distinct requests with otherwise identical fields. + Optional. If specified will make the request unique even with the same arguments. @@ -863,7 +836,7 @@ Argument to pass to the canister method The user who issued the request An upper limit on the validity of the request, expressed in nanoseconds since 1970-01-01 - Optional. Arbitrary user-provided data, typically randomly generated. This can be used to create distinct requests with otherwise identical fields. + Optional. If specified will make the request unique even with the same arguments @@ -905,16 +878,16 @@ - Optional. Arbitrary user-provided data, typically randomly generated. - This can be used to create distinct requests with otherwise identical fields. + Optional. If specified will make the request unique even with the same arguments - + The principal of the canister to call Name of the canister method to call Arguments to pass to the canister method The user who issued the request The expiration of the request to avoid replay attacks + Optional. If specified will make the request unique even with the same arguments diff --git a/src/Agent/Agents/HttpAgent.cs b/src/Agent/Agents/HttpAgent.cs index 51207d2e..b36cff9c 100644 --- a/src/Agent/Agents/HttpAgent.cs +++ b/src/Agent/Agents/HttpAgent.cs @@ -64,12 +64,12 @@ public async Task CallAsync( { // If v3 is not available, fall back to v2 this.v3CallSupported = false; - return await ((IAgent)this).CallAsynchronousAndWaitAsync(content, effectiveCanisterId, cancellationToken); + return await this.CallAsynchronousAndWaitAsync(content, effectiveCanisterId, cancellationToken); } if (httpResponse.StatusCode == System.Net.HttpStatusCode.Accepted) { // If request takes too long, then it will return 202 Accepted and polling is required - return await ((IAgent)this).WaitForRequestAsync(content.Request.CanisterId, content.RequestId, cancellationToken); + return await this.WaitForRequestAsync(content.Request.CanisterId, content.RequestId, cancellationToken); } await httpResponse.ThrowIfErrorAsync(); @@ -83,7 +83,7 @@ public async Task CallAsync( throw new InvalidCertificateException("Certificate signature does not match the IC public key"); } HashTree? requestStatusData = v3CallResponse.Certificate.Tree.GetValueOrDefault(StatePath.FromSegments("request_status", content.RequestId.RawValue)); - RequestStatus? requestStatus = IAgent.ParseRequestStatus(requestStatusData); + RequestStatus? requestStatus = IAgentExtensions.ParseRequestStatus(requestStatusData); switch (requestStatus?.Type) { case RequestStatus.StatusType.Replied: diff --git a/src/Agent/Agents/IAgent.cs b/src/Agent/Agents/IAgent.cs index 45dc161d..9b6a61ca 100644 --- a/src/Agent/Agents/IAgent.cs +++ b/src/Agent/Agents/IAgent.cs @@ -38,28 +38,35 @@ public interface IAgent /// Optional. Token to cancel request /// The root public key bytes Task GetRootKeyAsync(CancellationToken? cancellationToken = null); + } - + /// + /// Extension methods for the `IAgent` interface + /// + public static class IAgentExtensions + { /// /// Gets the state of a specified canister with the subset of state information /// specified by the paths parameter /// + /// The agent to use for the call /// Canister to read state for /// The state paths to get information for. Other state data will be pruned if not specified /// Optional. Identity to sign the request with /// Optional. Token to cancel request /// A response that contains the certificate of the current canister state - public async Task ReadStateAsync( + public static async Task ReadStateAsync( + this IAgent agent, Principal canisterId, List paths, IIdentity? identity = null, CancellationToken? cancellationToken = null) { - SignedContent content = this.SignContent( + SignedContent content = SignContent( identity, (sender, ingressExpiry) => new ReadStateRequest(paths, sender, ingressExpiry) ); - return await this.ReadStateAsync(canisterId, content, cancellationToken); + return await agent.ReadStateAsync(canisterId, content, cancellationToken); } @@ -67,6 +74,7 @@ public async Task ReadStateAsync( /// Sends a call request to a specified canister method and gets the response candid arg back using /v3/../call /// and falls back to /v2/../call if the v3 is not available /// + /// The agent to use for the call /// Canister to read state for /// The name of the method to call on the canister /// The candid arg to send with the request @@ -75,7 +83,8 @@ public async Task ReadStateAsync( /// Optional. Specifies the relevant canister id if calling the root canister /// Optional. Token to cancel request /// The id of the request that can be used to look up its status with `GetRequestStatusAsync` - public async Task CallAsync( + public static async Task CallAsync( + this IAgent agent, Principal canisterId, string method, CandidArg arg, @@ -85,20 +94,21 @@ public async Task CallAsync( CancellationToken? cancellationToken = null ) { - SignedContent content = this.SignContent( + SignedContent content = SignContent( identity, (sender, ingressExpiry) => { return new CallRequest(canisterId, method, arg, sender, ingressExpiry, nonce); } ); - return await this.CallAsync(content, effectiveCanisterId, cancellationToken); + return await agent.CallAsync(content, effectiveCanisterId, cancellationToken); } /// /// Sends a query request to a specified canister method /// + /// The agent to use for the call /// Canister to read state for /// The name of the method to call on the canister /// The candid arg to send with the request @@ -107,7 +117,8 @@ public async Task CallAsync( /// Optional. Specifies the relevant canister id if calling the root canister /// Optional. Token to cancel request /// The response data of the query call - public async Task QueryAsync( + public static async Task QueryAsync( + this IAgent agent, Principal canisterId, string method, CandidArg arg, @@ -117,11 +128,11 @@ public async Task QueryAsync( CancellationToken? cancellationToken = null ) { - SignedContent content = this.SignContent( + SignedContent content = SignContent( identity, (sender, ingressExpiry) => new QueryRequest(canisterId, method, arg, sender, ingressExpiry, nonce) ); - return await this.QueryAsync(content, effectiveCanisterId, cancellationToken); + return await agent.QueryAsync(content, effectiveCanisterId, cancellationToken); } @@ -130,6 +141,7 @@ public async Task QueryAsync( /// request that is being processed using /v2/../call. This call does NOT wait for the request to be complete. /// Either check the status with `GetRequestStatusAsync` or use the `CallV2AndWaitAsync` method /// + /// The agent to use for the call /// Canister to read state for /// The name of the method to call on the canister /// The candid arg to send with the request @@ -138,7 +150,8 @@ public async Task QueryAsync( /// Optional. Specifies the relevant canister id if calling the root canister /// Optional. Token to cancel request /// The id of the request that can be used to look up its status with `GetRequestStatusAsync` - public async Task CallAsynchronousAsync( + public static async Task CallAsynchronousAsync( + this IAgent agent, Principal canisterId, string method, CandidArg arg, @@ -148,14 +161,14 @@ public async Task CallAsynchronousAsync( CancellationToken? cancellationToken = null ) { - SignedContent content = this.SignContent( + SignedContent content = SignContent( identity, (sender, ingressExpiry) => { return new CallRequest(canisterId, method, arg, sender, ingressExpiry, nonce); } ); - return await this.CallAsynchronousAsync(content, effectiveCanisterId, cancellationToken); + return await agent.CallAsynchronousAsync(content, effectiveCanisterId, cancellationToken); } @@ -164,6 +177,7 @@ public async Task CallAsynchronousAsync( /// the returns the candid response to the call. This is helper method built on top of `CallAsynchronousAsync` /// to wait for the response so it doesn't need to be implemented manually ///
+ /// The agent to use for the call /// Canister to read state for /// The name of the method to call on the canister /// The candid arg to send with the request @@ -172,7 +186,8 @@ public async Task CallAsynchronousAsync( /// Optional. Specifies the relevant canister id if calling the root canister /// Optional. Token to cancel request /// The raw candid arg response - public async Task CallAsynchronousAndWaitAsync( + public static async Task CallAsynchronousAndWaitAsync( + this IAgent agent, Principal canisterId, string method, CandidArg arg, @@ -181,30 +196,33 @@ public async Task CallAsynchronousAndWaitAsync( Principal? effectiveCanisterId = null, CancellationToken? cancellationToken = null) { - RequestId id = await this.CallAsynchronousAsync(canisterId, method, arg, identity, nonce, effectiveCanisterId, cancellationToken); - return await this.WaitForRequestAsync(canisterId, id, cancellationToken); + RequestId id = await agent.CallAsynchronousAsync(canisterId, method, arg, identity, nonce, effectiveCanisterId, cancellationToken); + return await agent.WaitForRequestAsync(canisterId, id, cancellationToken); } - public async Task CallAsynchronousAndWaitAsync( + public static async Task CallAsynchronousAndWaitAsync( + this IAgent agent, SignedContent content, Principal? effectiveCanisterId = null, CancellationToken? cancellationToken = null) { - RequestId id = await this.CallAsynchronousAsync(content, effectiveCanisterId, cancellationToken); - return await this.WaitForRequestAsync(content.Request.CanisterId, id, cancellationToken); + RequestId id = await agent.CallAsynchronousAsync(content, effectiveCanisterId, cancellationToken); + return await agent.WaitForRequestAsync(content.Request.CanisterId, id, cancellationToken); } /// /// Gets the status of a request that is being processed by the specified canister /// + /// The agent to use for the call /// Canister where the request was sent to /// Id of the request to get a status for /// Optional. Identity to sign the request with /// Optional. Token to cancel request /// A status variant of the request. If request is not found, will return null - public async Task GetRequestStatusAsync( + public static async Task GetRequestStatusAsync( + this IAgent agent, Principal canisterId, RequestId id, IIdentity? identity = null, @@ -213,8 +231,8 @@ public async Task CallAsynchronousAndWaitAsync( { var pathRequestStatus = StatePath.FromSegments("request_status", id.RawValue); var paths = new List { pathRequestStatus }; - SignedContent signedContent = this.SignContent(identity, (sender, ingressExpiry) => new ReadStateRequest(paths, sender, ingressExpiry)); - ReadStateResponse response = await this.ReadStateAsync(canisterId, signedContent, cancellationToken); + SignedContent signedContent = SignContent(identity, (sender, ingressExpiry) => new ReadStateRequest(paths, sender, ingressExpiry)); + ReadStateResponse response = await agent.ReadStateAsync(canisterId, signedContent, cancellationToken); HashTree? requestStatus = response.Certificate.Tree.GetValueOrDefault(pathRequestStatus); return ParseRequestStatus(requestStatus); } @@ -224,11 +242,13 @@ public async Task CallAsynchronousAndWaitAsync( /// method built on top of `GetRequestStatusAsync` to wait for the response so it doesn't need to be /// implemented manually ///
+ /// The agent to use for the call /// Canister to read state for /// The unique identifier for the request /// Optional. Token to cancel request /// The raw candid arg response - public async Task WaitForRequestAsync( + public static async Task WaitForRequestAsync( + this IAgent agent, Principal canisterId, RequestId requestId, CancellationToken? cancellationToken = null @@ -238,7 +258,7 @@ public async Task WaitForRequestAsync( { cancellationToken?.ThrowIfCancellationRequested(); - RequestStatus? requestStatus = await this.GetRequestStatusAsync(canisterId, requestId); + RequestStatus? requestStatus = await agent.GetRequestStatusAsync(canisterId, requestId); cancellationToken?.ThrowIfCancellationRequested(); @@ -288,7 +308,7 @@ public async Task WaitForRequestAsync( } - private SignedContent SignContent( + private static SignedContent SignContent( IIdentity? identity, Func getRequest ) diff --git a/src/Agent/Models/SignedContent.cs b/src/Agent/Models/SignedContent.cs index f9241fac..17b84a56 100644 --- a/src/Agent/Models/SignedContent.cs +++ b/src/Agent/Models/SignedContent.cs @@ -86,6 +86,12 @@ public byte[] ToCborBytes() { CborWriter writer = new (); writer.WriteTag(CborTag.SelfDescribeCbor); + this.WriteCbor(writer); + return writer.Encode(); + } + + internal void WriteCbor(CborWriter writer) + { writer.WriteStartMap(null); writer.WriteTextString(Properties.CONTENT); Dictionary hashableContent = this.Request.BuildHashableItem(); @@ -105,7 +111,7 @@ public byte[] ToCborBytes() { writer.WriteTextString(Properties.SENDER_DELEGATION); writer.WriteStartArray(this.SenderDelegations.Count); - foreach(IHashable value in this.SenderDelegations) + foreach (IHashable value in this.SenderDelegations) { writer.WriteHashableValue(value); } @@ -117,7 +123,6 @@ public byte[] ToCborBytes() writer.WriteByteString(this.SenderSignature); } writer.WriteEndMap(); - return writer.Encode(); } internal class Properties diff --git a/src/Agent/Standards/AssetCanister/AssetCanisterApiClient.cs b/src/Agent/Standards/AssetCanister/AssetCanisterApiClient.cs index 003a27ad..8445f4bc 100644 --- a/src/Agent/Standards/AssetCanister/AssetCanisterApiClient.cs +++ b/src/Agent/Standards/AssetCanister/AssetCanisterApiClient.cs @@ -251,8 +251,7 @@ public async Task UploadAssetChunkedAsync( public async Task GetApiVersionAsync() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "api_version", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "api_version", arg); return reply.ToObjects(this.Converter); } @@ -266,8 +265,7 @@ public async Task GetAsync(string key, List acceptEncodings) { GetRequest request = new(key, acceptEncodings); CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(request, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get", arg); return reply.ToObjects(this.Converter); } @@ -292,8 +290,7 @@ public async Task GetChunkAsync( GetChunkRequest request = new(key, contentEncoding, index, sha256Opt); CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(request, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_chunk", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_chunk", arg); return reply.ToObjects(this.Converter); } @@ -304,8 +301,7 @@ public async Task GetChunkAsync( public async Task> ListAsync() { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.EmptyRecord()); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list", arg); return reply.ToObjects>(this.Converter); } @@ -316,8 +312,7 @@ public async Task> ListAsync() public async Task GetCertifiedTreeAsync() { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.EmptyRecord()); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "certified_tree", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "certified_tree", arg); return reply.ToObjects(this.Converter); } @@ -620,8 +615,7 @@ public async Task TakeOwnershipAsync() public async Task GetAssetPropertiesAsync(string key) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(key, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_asset_properties", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_asset_properties", arg); return reply.ToObjects(this.Converter); } diff --git a/src/Agent/Standards/ICRC1/ICRC1Client.cs b/src/Agent/Standards/ICRC1/ICRC1Client.cs index 8434d597..4ad8b720 100644 --- a/src/Agent/Standards/ICRC1/ICRC1Client.cs +++ b/src/Agent/Standards/ICRC1/ICRC1Client.cs @@ -39,8 +39,7 @@ public ICRC1Client(IAgent agent, Principal canisterId) public async Task> MetaData() { CandidArg arg = CandidArg.FromCandid(); - Responses.QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "icrc1_meta_data", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "icrc1_meta_data", arg); return reply.ToObjects>(); } @@ -51,8 +50,7 @@ public async Task> MetaData() public async Task Name() { CandidArg arg = CandidArg.FromCandid(); - Responses.QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "icrc1_name", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "icrc1_name", arg); return reply.ToObjects(); } @@ -63,8 +61,7 @@ public async Task Name() public async Task Symbol() { CandidArg arg = CandidArg.FromCandid(); - Responses.QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "icrc1_symbol", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "icrc1_symbol", arg); return reply.ToObjects(); } @@ -75,8 +72,7 @@ public async Task Symbol() public async Task Decimals() { CandidArg arg = CandidArg.FromCandid(); - Responses.QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "icrc1_decimals", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "icrc1_decimals", arg); return reply.ToObjects(); } @@ -87,8 +83,7 @@ public async Task Decimals() public async Task Fee() { CandidArg arg = CandidArg.FromCandid(); - Responses.QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "icrc1_fee", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "icrc1_fee", arg); return reply.ToObjects(); } @@ -99,8 +94,7 @@ public async Task Fee() public async Task TotalSupply() { CandidArg arg = CandidArg.FromCandid(); - Responses.QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "icrc1_total_supply", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "icrc1_total_supply", arg); return reply.ToObjects(); } @@ -111,8 +105,7 @@ public async Task TotalSupply() public async Task> MintingAccount() { CandidArg arg = CandidArg.FromCandid(); - Responses.QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "icrc1_minting_account", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "icrc1_minting_account", arg); return reply.ToObjects>(); } @@ -124,8 +117,7 @@ public async Task> MintingAccount() public async Task BalanceOf(Account account) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(account)); - Responses.QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "icrc1_balance_of", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "icrc1_balance_of", arg); return reply.ToObjects(); } @@ -148,9 +140,8 @@ public async Task Transfer(TransferArgs args) public async Task> SupportedStandards() { CandidArg arg = CandidArg.FromCandid(); - Responses.QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "icrc1_supported_standards", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "icrc1_supported_standards", arg); return reply.ToObjects>(); } } -} \ No newline at end of file +} diff --git a/src/ClientGenerator/ClientCodeGenerator.cs b/src/ClientGenerator/ClientCodeGenerator.cs index 6ee0c06a..cbd98fac 100644 --- a/src/ClientGenerator/ClientCodeGenerator.cs +++ b/src/ClientGenerator/ClientCodeGenerator.cs @@ -30,7 +30,7 @@ public static async Task GenerateClientFromCanisterAsync( ClientGenerationOptions options ) { - var agent = new HttpAgent(identity: null, httpBoundryNodeUrl: options.BoundryNodeUrl); + IAgent agent = new HttpAgent(httpBoundryNodeUrl: options.BoundryNodeUrl); var candidServicePath = StatePath.FromSegments("canister", canisterId.Raw, "metadata", "candid:service"); var paths = new List { diff --git a/src/PocketIC/API.xml b/src/PocketIC/API.xml index 0e2594db..433de4e6 100644 --- a/src/PocketIC/API.xml +++ b/src/PocketIC/API.xml @@ -1285,11 +1285,10 @@ The URL of the HTTP gateway - + Creates a new HTTP agent configured to use this gateway - Optional identity to use for the agent, otherwise will use anonymous identity A configured HTTP agent diff --git a/src/PocketIC/PocketIc.cs b/src/PocketIC/PocketIc.cs index 51f3dbef..11fe69ec 100644 --- a/src/PocketIC/PocketIc.cs +++ b/src/PocketIC/PocketIc.cs @@ -984,12 +984,10 @@ internal HttpGateway(Uri url, Func disposeTask) /// /// Creates a new HTTP agent configured to use this gateway /// - /// Optional identity to use for the agent, otherwise will use anonymous identity /// A configured HTTP agent - public HttpAgent BuildHttpAgent(IIdentity? identity = null) + public HttpAgent BuildHttpAgent() { return new HttpAgent( - identity: identity, httpBoundryNodeUrl: this.Url ); } @@ -1018,4 +1016,4 @@ public async ValueTask DisposeAsync() } } -} \ No newline at end of file +} diff --git a/src/WebSockets/API.xml b/src/WebSockets/API.xml index df206e9d..2efde702 100644 --- a/src/WebSockets/API.xml +++ b/src/WebSockets/API.xml @@ -168,13 +168,6 @@ The custom websocket client implementation. The WebSocketBuilder instance. - - - Sets a custom BLS cryptography implementation to override the default. - - The custom BLS cryptography implementation. - The WebSocketBuilder instance. - Builds the WebSocket agent from the specified configuration. diff --git a/src/WebSockets/WebSocketAgent.cs b/src/WebSockets/WebSocketAgent.cs index 4799b2f3..4af4be8c 100644 --- a/src/WebSockets/WebSocketAgent.cs +++ b/src/WebSockets/WebSocketAgent.cs @@ -33,7 +33,6 @@ internal class WebSocketAgent : IWebSocketAgent private Principal canisterId { get; } private Uri gatewayUri { get; } private IIdentity identity { get; } - private IBlsCryptography bls { get; } private SubjectPublicKeyInfo RootPublicKey { get; } private CandidConverter? customConverter { get; } private IWebSocketClient client { get; } @@ -50,7 +49,6 @@ public WebSocketAgent( SubjectPublicKeyInfo rootPublicKey, IIdentity identity, IWebSocketClient client, - IBlsCryptography bls, Action onMessage, Action? onOpen = null, Action? onError = null, @@ -63,7 +61,6 @@ public WebSocketAgent( this.RootPublicKey = rootPublicKey ?? throw new ArgumentNullException(nameof(rootPublicKey)); this.identity = identity ?? throw new ArgumentNullException(nameof(identity)); this.client = client ?? throw new ArgumentNullException(nameof(client)); - this.bls = bls ?? throw new ArgumentNullException(nameof(bls)); this.onMessage = onMessage ?? throw new ArgumentNullException(nameof(onMessage)); this.onOpen = onOpen; this.onError = onError; @@ -287,7 +284,7 @@ private bool ValidateMessage( } - if (cert == null || !cert.IsValid(this.bls, this.RootPublicKey)) + if (cert == null || !cert.IsValid(this.RootPublicKey)) { error = "Message certificate is invalid: Invalid signature"; return false; @@ -493,8 +490,8 @@ CancellationToken cancellationToken sender, ICTimestamp.Future(TimeSpan.FromSeconds(30)) ); - SignedContent signedContent = this.identity - .SignContent(request.BuildHashableItem()); + SignedContent signedContent = this.identity + .SignContent(request); CborWriter writer = new CborWriter(); writer.WriteStartMap(1); diff --git a/src/WebSockets/WebSocketBuilder.cs b/src/WebSockets/WebSocketBuilder.cs index 19110096..3431911c 100644 --- a/src/WebSockets/WebSocketBuilder.cs +++ b/src/WebSockets/WebSocketBuilder.cs @@ -20,7 +20,6 @@ public class WebSocketBuilder private Uri gatewayUri { get; } private IIdentity? identity { get; set; } private IWebSocketClient? client { get; set; } - private IBlsCryptography? bls { get; set; } private SubjectPublicKeyInfo? rootPublicKey { get; set; } private CandidConverter? customConverter { get; set; } private Action? onMessage { get; set; } @@ -146,17 +145,6 @@ public WebSocketBuilder WithCustomClient(IWebSocketClient client) return this; } - /// - /// Sets a custom BLS cryptography implementation to override the default. - /// - /// The custom BLS cryptography implementation. - /// The WebSocketBuilder instance. - public WebSocketBuilder WithCustomBlsCryptography(IBlsCryptography bls) - { - this.bls = bls; - return this; - } - /// /// Builds the WebSocket agent from the specified configuration. /// Will NOT connect the agent to the WebSocket gateway @@ -182,17 +170,12 @@ public IWebSocketAgent Build() { this.client = new WebSocketClient(); } - if (this.bls == null) - { - this.bls = new DefaultBlsCryptograhy(); - } return new WebSocketAgent( this.canisterId, this.gatewayUri, this.rootPublicKey, this.identity, this.client, - this.bls, this.onMessage, this.onOpen, this.onError, diff --git a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap index c80d574a..a83ffce9 100644 --- a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap @@ -23,16 +23,14 @@ namespace Test public async Task>> A() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "a", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); return reply.ToObjects>>(this.Converter); } public async Task> B() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "b", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "b", arg); return reply.ToObjects>(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap index c80d574a..a83ffce9 100644 --- a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap @@ -23,16 +23,14 @@ namespace Test public async Task>> A() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "a", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); return reply.ToObjects>>(this.Converter); } public async Task> B() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "b", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "b", arg); return reply.ToObjects>(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap index c80d574a..a83ffce9 100644 --- a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap @@ -23,16 +23,14 @@ namespace Test public async Task>> A() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "a", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); return reply.ToObjects>>(this.Converter); } public async Task> B() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "b", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "b", arg); return reply.ToObjects>(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap index c80d574a..a83ffce9 100644 --- a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap @@ -23,16 +23,14 @@ namespace Test public async Task>> A() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "a", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); return reply.ToObjects>>(this.Converter); } public async Task> B() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "b", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "b", arg); return reply.ToObjects>(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap index 080588ce..fdc518b4 100644 --- a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap @@ -23,16 +23,14 @@ namespace Test public async Task>> a() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "a", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); return reply.ToObjects>>(this.Converter); } public async Task> b() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "b", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "b", arg); return reply.ToObjects>(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap index 080588ce..fdc518b4 100644 --- a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap @@ -23,16 +23,14 @@ namespace Test public async Task>> a() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "a", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); return reply.ToObjects>>(this.Converter); } public async Task> b() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "b", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "b", arg); return reply.ToObjects>(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap index 080588ce..fdc518b4 100644 --- a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap @@ -23,16 +23,14 @@ namespace Test public async Task>> a() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "a", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); return reply.ToObjects>>(this.Converter); } public async Task> b() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "b", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "b", arg); return reply.ToObjects>(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap index 080588ce..fdc518b4 100644 --- a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap @@ -23,16 +23,14 @@ namespace Test public async Task>> a() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "a", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); return reply.ToObjects>>(this.Converter); } public async Task> b() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "b", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "b", arg); return reply.ToObjects>(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap index 2a36ca3f..e613e1e8 100644 --- a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap @@ -23,16 +23,14 @@ namespace Test public async Task>> A() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "a", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); return reply.ToObjects>>(this.Converter); } public async Task> B() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "b", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "b", arg); return reply.ToObjects>(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap index 2a36ca3f..e613e1e8 100644 --- a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap @@ -23,16 +23,14 @@ namespace Test public async Task>> A() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "a", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); return reply.ToObjects>>(this.Converter); } public async Task> B() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "b", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "b", arg); return reply.ToObjects>(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap index 2a36ca3f..e613e1e8 100644 --- a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap @@ -23,16 +23,14 @@ namespace Test public async Task>> A() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "a", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); return reply.ToObjects>>(this.Converter); } public async Task> B() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "b", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "b", arg); return reply.ToObjects>(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap index 2a36ca3f..e613e1e8 100644 --- a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap @@ -23,16 +23,14 @@ namespace Test public async Task>> A() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "a", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); return reply.ToObjects>>(this.Converter); } public async Task> B() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "b", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "b", arg); return reply.ToObjects>(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap index 507a3bb9..217047c1 100644 --- a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap @@ -23,16 +23,14 @@ namespace Test public async Task>> a() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "a", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); return reply.ToObjects>>(this.Converter); } public async Task> b() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "b", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "b", arg); return reply.ToObjects>(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap index 507a3bb9..217047c1 100644 --- a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap @@ -23,16 +23,14 @@ namespace Test public async Task>> a() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "a", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); return reply.ToObjects>>(this.Converter); } public async Task> b() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "b", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "b", arg); return reply.ToObjects>(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap index 507a3bb9..217047c1 100644 --- a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap @@ -23,16 +23,14 @@ namespace Test public async Task>> a() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "a", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); return reply.ToObjects>>(this.Converter); } public async Task> b() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "b", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "b", arg); return reply.ToObjects>(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap index 507a3bb9..217047c1 100644 --- a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap @@ -23,16 +23,14 @@ namespace Test public async Task>> a() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "a", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); return reply.ToObjects>>(this.Converter); } public async Task> b() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "b", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "b", arg); return reply.ToObjects>(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap index c80d574a..a83ffce9 100644 --- a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap @@ -23,16 +23,14 @@ namespace Test public async Task>> A() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "a", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); return reply.ToObjects>>(this.Converter); } public async Task> B() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "b", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "b", arg); return reply.ToObjects>(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap index c80d574a..a83ffce9 100644 --- a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap @@ -23,16 +23,14 @@ namespace Test public async Task>> A() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "a", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); return reply.ToObjects>>(this.Converter); } public async Task> B() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "b", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "b", arg); return reply.ToObjects>(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap index c80d574a..a83ffce9 100644 --- a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap @@ -23,16 +23,14 @@ namespace Test public async Task>> A() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "a", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); return reply.ToObjects>>(this.Converter); } public async Task> B() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "b", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "b", arg); return reply.ToObjects>(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap index c80d574a..a83ffce9 100644 --- a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap @@ -23,16 +23,14 @@ namespace Test public async Task>> A() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "a", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); return reply.ToObjects>>(this.Converter); } public async Task> B() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "b", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "b", arg); return reply.ToObjects>(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap index 080588ce..fdc518b4 100644 --- a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap @@ -23,16 +23,14 @@ namespace Test public async Task>> a() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "a", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); return reply.ToObjects>>(this.Converter); } public async Task> b() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "b", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "b", arg); return reply.ToObjects>(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap index 080588ce..fdc518b4 100644 --- a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap @@ -23,16 +23,14 @@ namespace Test public async Task>> a() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "a", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); return reply.ToObjects>>(this.Converter); } public async Task> b() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "b", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "b", arg); return reply.ToObjects>(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap index 080588ce..fdc518b4 100644 --- a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap @@ -23,16 +23,14 @@ namespace Test public async Task>> a() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "a", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); return reply.ToObjects>>(this.Converter); } public async Task> b() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "b", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "b", arg); return reply.ToObjects>(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap index 080588ce..fdc518b4 100644 --- a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap @@ -23,16 +23,14 @@ namespace Test public async Task>> a() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "a", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); return reply.ToObjects>>(this.Converter); } public async Task> b() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "b", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "b", arg); return reply.ToObjects>(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap index 2a36ca3f..e613e1e8 100644 --- a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap @@ -23,16 +23,14 @@ namespace Test public async Task>> A() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "a", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); return reply.ToObjects>>(this.Converter); } public async Task> B() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "b", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "b", arg); return reply.ToObjects>(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap index 2a36ca3f..e613e1e8 100644 --- a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap @@ -23,16 +23,14 @@ namespace Test public async Task>> A() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "a", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); return reply.ToObjects>>(this.Converter); } public async Task> B() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "b", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "b", arg); return reply.ToObjects>(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap index 2a36ca3f..e613e1e8 100644 --- a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap @@ -23,16 +23,14 @@ namespace Test public async Task>> A() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "a", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); return reply.ToObjects>>(this.Converter); } public async Task> B() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "b", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "b", arg); return reply.ToObjects>(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap index 2a36ca3f..e613e1e8 100644 --- a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap @@ -23,16 +23,14 @@ namespace Test public async Task>> A() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "a", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); return reply.ToObjects>>(this.Converter); } public async Task> B() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "b", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "b", arg); return reply.ToObjects>(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap index 507a3bb9..217047c1 100644 --- a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap @@ -23,16 +23,14 @@ namespace Test public async Task>> a() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "a", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); return reply.ToObjects>>(this.Converter); } public async Task> b() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "b", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "b", arg); return reply.ToObjects>(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap index 507a3bb9..217047c1 100644 --- a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap @@ -23,16 +23,14 @@ namespace Test public async Task>> a() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "a", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); return reply.ToObjects>>(this.Converter); } public async Task> b() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "b", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "b", arg); return reply.ToObjects>(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap index 507a3bb9..217047c1 100644 --- a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap @@ -23,16 +23,14 @@ namespace Test public async Task>> a() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "a", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); return reply.ToObjects>>(this.Converter); } public async Task> b() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "b", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "b", arg); return reply.ToObjects>(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap index 507a3bb9..217047c1 100644 --- a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap @@ -23,16 +23,14 @@ namespace Test public async Task>> a() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "a", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); return reply.ToObjects>>(this.Converter); } public async Task> b() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "b", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "b", arg); return reply.ToObjects>(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap index 2017f5d3..4252024e 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap @@ -52,24 +52,21 @@ namespace Test public async Task> GetAllBalances() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "getAllBalances", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getAllBalances", arg); return reply.ToObjects>(this.Converter); } public async Task GetBalance(Token arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "getBalance", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalance", arg); return reply.ToObjects(this.Converter); } public async Task> GetBalances() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "getBalances", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalances", arg); return reply.ToObjects>(this.Converter); } @@ -111,8 +108,7 @@ namespace Test public async Task Whoami() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "whoami", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "whoami", arg); return reply.ToObjects(this.Converter); } diff --git a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap index a37a3107..1cdef712 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap @@ -52,24 +52,21 @@ namespace Test public async Task> GetAllBalances() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "getAllBalances", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getAllBalances", arg); return reply.ToObjects>(this.Converter); } public async Task GetBalance(Token arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "getBalance", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalance", arg); return reply.ToObjects(this.Converter); } public async Task> GetBalances() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "getBalances", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalances", arg); return reply.ToObjects>(this.Converter); } @@ -111,8 +108,7 @@ namespace Test public async Task Whoami() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "whoami", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "whoami", arg); return reply.ToObjects(this.Converter); } diff --git a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap index 68d36583..a2379dff 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap @@ -52,24 +52,21 @@ namespace Test public async Task> GetAllBalances() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "getAllBalances", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getAllBalances", arg); return reply.ToObjects>(this.Converter); } public async Task GetBalance(Token arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "getBalance", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalance", arg); return reply.ToObjects(this.Converter); } public async Task> GetBalances() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "getBalances", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalances", arg); return reply.ToObjects>(this.Converter); } @@ -111,8 +108,7 @@ namespace Test public async Task Whoami() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "whoami", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "whoami", arg); return reply.ToObjects(this.Converter); } diff --git a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap index fe03b5a4..e6399144 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap @@ -52,24 +52,21 @@ namespace Test public async Task> GetAllBalances() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "getAllBalances", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getAllBalances", arg); return reply.ToObjects>(this.Converter); } public async Task GetBalance(Token arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "getBalance", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalance", arg); return reply.ToObjects(this.Converter); } public async Task> GetBalances() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "getBalances", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalances", arg); return reply.ToObjects>(this.Converter); } @@ -111,8 +108,7 @@ namespace Test public async Task Whoami() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "whoami", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "whoami", arg); return reply.ToObjects(this.Converter); } diff --git a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap index 57db9c55..9c764ae4 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap @@ -52,24 +52,21 @@ namespace Test public async Task> getAllBalances() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "getAllBalances", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getAllBalances", arg); return reply.ToObjects>(this.Converter); } public async Task getBalance(Token arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "getBalance", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalance", arg); return reply.ToObjects(this.Converter); } public async Task> getBalances() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "getBalances", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalances", arg); return reply.ToObjects>(this.Converter); } @@ -111,8 +108,7 @@ namespace Test public async Task whoami() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "whoami", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "whoami", arg); return reply.ToObjects(this.Converter); } diff --git a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap index fed4ac44..eb58ebd5 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap @@ -52,24 +52,21 @@ namespace Test public async Task> getAllBalances() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "getAllBalances", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getAllBalances", arg); return reply.ToObjects>(this.Converter); } public async Task getBalance(Token arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "getBalance", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalance", arg); return reply.ToObjects(this.Converter); } public async Task> getBalances() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "getBalances", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalances", arg); return reply.ToObjects>(this.Converter); } @@ -111,8 +108,7 @@ namespace Test public async Task whoami() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "whoami", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "whoami", arg); return reply.ToObjects(this.Converter); } diff --git a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap index 1fa13a32..9c69364c 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap @@ -52,24 +52,21 @@ namespace Test public async Task> getAllBalances() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "getAllBalances", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getAllBalances", arg); return reply.ToObjects>(this.Converter); } public async Task getBalance(Token arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "getBalance", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalance", arg); return reply.ToObjects(this.Converter); } public async Task> getBalances() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "getBalances", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalances", arg); return reply.ToObjects>(this.Converter); } @@ -111,8 +108,7 @@ namespace Test public async Task whoami() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "whoami", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "whoami", arg); return reply.ToObjects(this.Converter); } diff --git a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap index 8a14b960..a0752f2b 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap @@ -52,24 +52,21 @@ namespace Test public async Task> getAllBalances() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "getAllBalances", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getAllBalances", arg); return reply.ToObjects>(this.Converter); } public async Task getBalance(Token arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "getBalance", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalance", arg); return reply.ToObjects(this.Converter); } public async Task> getBalances() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "getBalances", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalances", arg); return reply.ToObjects>(this.Converter); } @@ -111,8 +108,7 @@ namespace Test public async Task whoami() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "whoami", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "whoami", arg); return reply.ToObjects(this.Converter); } diff --git a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap index 47ba48d0..472936f8 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap @@ -52,24 +52,21 @@ namespace Test public async Task> GetAllBalances() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "getAllBalances", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getAllBalances", arg); return reply.ToObjects>(this.Converter); } public async Task GetBalance(Token arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "getBalance", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalance", arg); return reply.ToObjects(this.Converter); } public async Task> GetBalances() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "getBalances", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalances", arg); return reply.ToObjects>(this.Converter); } @@ -111,8 +108,7 @@ namespace Test public async Task Whoami() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "whoami", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "whoami", arg); return reply.ToObjects(this.Converter); } diff --git a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap index bda14fa4..a42d2d0b 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap @@ -52,24 +52,21 @@ namespace Test public async Task> GetAllBalances() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "getAllBalances", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getAllBalances", arg); return reply.ToObjects>(this.Converter); } public async Task GetBalance(Token arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "getBalance", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalance", arg); return reply.ToObjects(this.Converter); } public async Task> GetBalances() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "getBalances", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalances", arg); return reply.ToObjects>(this.Converter); } @@ -111,8 +108,7 @@ namespace Test public async Task Whoami() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "whoami", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "whoami", arg); return reply.ToObjects(this.Converter); } diff --git a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap index 07ebb0df..a153ab99 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap @@ -52,24 +52,21 @@ namespace Test public async Task> GetAllBalances() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "getAllBalances", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getAllBalances", arg); return reply.ToObjects>(this.Converter); } public async Task GetBalance(Token arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "getBalance", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalance", arg); return reply.ToObjects(this.Converter); } public async Task> GetBalances() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "getBalances", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalances", arg); return reply.ToObjects>(this.Converter); } @@ -111,8 +108,7 @@ namespace Test public async Task Whoami() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "whoami", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "whoami", arg); return reply.ToObjects(this.Converter); } diff --git a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap index dfb6051c..36004d90 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap @@ -52,24 +52,21 @@ namespace Test public async Task> GetAllBalances() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "getAllBalances", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getAllBalances", arg); return reply.ToObjects>(this.Converter); } public async Task GetBalance(Token arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "getBalance", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalance", arg); return reply.ToObjects(this.Converter); } public async Task> GetBalances() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "getBalances", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalances", arg); return reply.ToObjects>(this.Converter); } @@ -111,8 +108,7 @@ namespace Test public async Task Whoami() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "whoami", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "whoami", arg); return reply.ToObjects(this.Converter); } diff --git a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap index cf7edc36..ede3ebee 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap @@ -52,24 +52,21 @@ namespace Test public async Task> getAllBalances() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "getAllBalances", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getAllBalances", arg); return reply.ToObjects>(this.Converter); } public async Task getBalance(Token arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "getBalance", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalance", arg); return reply.ToObjects(this.Converter); } public async Task> getBalances() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "getBalances", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalances", arg); return reply.ToObjects>(this.Converter); } @@ -111,8 +108,7 @@ namespace Test public async Task whoami() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "whoami", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "whoami", arg); return reply.ToObjects(this.Converter); } diff --git a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap index acddb645..eec35235 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap @@ -52,24 +52,21 @@ namespace Test public async Task> getAllBalances() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "getAllBalances", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getAllBalances", arg); return reply.ToObjects>(this.Converter); } public async Task getBalance(Token arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "getBalance", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalance", arg); return reply.ToObjects(this.Converter); } public async Task> getBalances() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "getBalances", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalances", arg); return reply.ToObjects>(this.Converter); } @@ -111,8 +108,7 @@ namespace Test public async Task whoami() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "whoami", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "whoami", arg); return reply.ToObjects(this.Converter); } diff --git a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap index e11e3bc4..74f78570 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap @@ -52,24 +52,21 @@ namespace Test public async Task> getAllBalances() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "getAllBalances", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getAllBalances", arg); return reply.ToObjects>(this.Converter); } public async Task getBalance(Token arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "getBalance", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalance", arg); return reply.ToObjects(this.Converter); } public async Task> getBalances() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "getBalances", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalances", arg); return reply.ToObjects>(this.Converter); } @@ -111,8 +108,7 @@ namespace Test public async Task whoami() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "whoami", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "whoami", arg); return reply.ToObjects(this.Converter); } diff --git a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap index caddead7..ac1208d0 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap @@ -52,24 +52,21 @@ namespace Test public async Task> getAllBalances() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "getAllBalances", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getAllBalances", arg); return reply.ToObjects>(this.Converter); } public async Task getBalance(Token arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "getBalance", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalance", arg); return reply.ToObjects(this.Converter); } public async Task> getBalances() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "getBalances", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalances", arg); return reply.ToObjects>(this.Converter); } @@ -111,8 +108,7 @@ namespace Test public async Task whoami() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "whoami", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "whoami", arg); return reply.ToObjects(this.Converter); } diff --git a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap index 022a0541..efadbde5 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap @@ -52,24 +52,21 @@ namespace Test public async Task> GetAllBalances() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "getAllBalances", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getAllBalances", arg); return reply.ToObjects>(this.Converter); } public async Task GetBalance(Token arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "getBalance", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalance", arg); return reply.ToObjects(this.Converter); } public async Task> GetBalances() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "getBalances", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalances", arg); return reply.ToObjects>(this.Converter); } @@ -111,8 +108,7 @@ namespace Test public async Task Whoami() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "whoami", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "whoami", arg); return reply.ToObjects(this.Converter); } diff --git a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap index 3bcb3ba5..f0f0eaa7 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap @@ -52,24 +52,21 @@ namespace Test public async Task> GetAllBalances() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "getAllBalances", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getAllBalances", arg); return reply.ToObjects>(this.Converter); } public async Task GetBalance(Token arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "getBalance", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalance", arg); return reply.ToObjects(this.Converter); } public async Task> GetBalances() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "getBalances", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalances", arg); return reply.ToObjects>(this.Converter); } @@ -111,8 +108,7 @@ namespace Test public async Task Whoami() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "whoami", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "whoami", arg); return reply.ToObjects(this.Converter); } diff --git a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap index 8e5c5745..c10d09eb 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap @@ -52,24 +52,21 @@ namespace Test public async Task> GetAllBalances() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "getAllBalances", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getAllBalances", arg); return reply.ToObjects>(this.Converter); } public async Task GetBalance(Token arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "getBalance", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalance", arg); return reply.ToObjects(this.Converter); } public async Task> GetBalances() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "getBalances", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalances", arg); return reply.ToObjects>(this.Converter); } @@ -111,8 +108,7 @@ namespace Test public async Task Whoami() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "whoami", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "whoami", arg); return reply.ToObjects(this.Converter); } diff --git a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap index 226a10b9..5c4d1eb1 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap @@ -52,24 +52,21 @@ namespace Test public async Task> GetAllBalances() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "getAllBalances", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getAllBalances", arg); return reply.ToObjects>(this.Converter); } public async Task GetBalance(Token arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "getBalance", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalance", arg); return reply.ToObjects(this.Converter); } public async Task> GetBalances() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "getBalances", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalances", arg); return reply.ToObjects>(this.Converter); } @@ -111,8 +108,7 @@ namespace Test public async Task Whoami() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "whoami", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "whoami", arg); return reply.ToObjects(this.Converter); } diff --git a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap index 07c101d1..d40f39ed 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap @@ -52,24 +52,21 @@ namespace Test public async Task> getAllBalances() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "getAllBalances", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getAllBalances", arg); return reply.ToObjects>(this.Converter); } public async Task getBalance(Token arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "getBalance", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalance", arg); return reply.ToObjects(this.Converter); } public async Task> getBalances() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "getBalances", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalances", arg); return reply.ToObjects>(this.Converter); } @@ -111,8 +108,7 @@ namespace Test public async Task whoami() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "whoami", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "whoami", arg); return reply.ToObjects(this.Converter); } diff --git a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap index dfc25e21..5000034e 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap @@ -52,24 +52,21 @@ namespace Test public async Task> getAllBalances() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "getAllBalances", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getAllBalances", arg); return reply.ToObjects>(this.Converter); } public async Task getBalance(Token arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "getBalance", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalance", arg); return reply.ToObjects(this.Converter); } public async Task> getBalances() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "getBalances", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalances", arg); return reply.ToObjects>(this.Converter); } @@ -111,8 +108,7 @@ namespace Test public async Task whoami() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "whoami", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "whoami", arg); return reply.ToObjects(this.Converter); } diff --git a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap index 61357787..0c5bc358 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap @@ -52,24 +52,21 @@ namespace Test public async Task> getAllBalances() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "getAllBalances", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getAllBalances", arg); return reply.ToObjects>(this.Converter); } public async Task getBalance(Token arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "getBalance", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalance", arg); return reply.ToObjects(this.Converter); } public async Task> getBalances() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "getBalances", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalances", arg); return reply.ToObjects>(this.Converter); } @@ -111,8 +108,7 @@ namespace Test public async Task whoami() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "whoami", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "whoami", arg); return reply.ToObjects(this.Converter); } diff --git a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap index 09656aa9..ca51aa4a 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap @@ -52,24 +52,21 @@ namespace Test public async Task> getAllBalances() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "getAllBalances", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getAllBalances", arg); return reply.ToObjects>(this.Converter); } public async Task getBalance(Token arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "getBalance", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalance", arg); return reply.ToObjects(this.Converter); } public async Task> getBalances() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "getBalances", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalances", arg); return reply.ToObjects>(this.Converter); } @@ -111,8 +108,7 @@ namespace Test public async Task whoami() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "whoami", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "whoami", arg); return reply.ToObjects(this.Converter); } diff --git a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap index 61aa011b..89602c0e 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap @@ -52,24 +52,21 @@ namespace Test public async Task> GetAllBalances() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "getAllBalances", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getAllBalances", arg); return reply.ToObjects>(this.Converter); } public async Task GetBalance(Token arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "getBalance", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalance", arg); return reply.ToObjects(this.Converter); } public async Task> GetBalances() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "getBalances", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalances", arg); return reply.ToObjects>(this.Converter); } @@ -111,8 +108,7 @@ namespace Test public async Task Whoami() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "whoami", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "whoami", arg); return reply.ToObjects(this.Converter); } diff --git a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap index a98a888b..c940885d 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap @@ -52,24 +52,21 @@ namespace Test public async Task> GetAllBalances() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "getAllBalances", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getAllBalances", arg); return reply.ToObjects>(this.Converter); } public async Task GetBalance(Token arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "getBalance", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalance", arg); return reply.ToObjects(this.Converter); } public async Task> GetBalances() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "getBalances", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalances", arg); return reply.ToObjects>(this.Converter); } @@ -111,8 +108,7 @@ namespace Test public async Task Whoami() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "whoami", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "whoami", arg); return reply.ToObjects(this.Converter); } diff --git a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap index cb9f3028..1fdae881 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap @@ -52,24 +52,21 @@ namespace Test public async Task> GetAllBalances() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "getAllBalances", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getAllBalances", arg); return reply.ToObjects>(this.Converter); } public async Task GetBalance(Token arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "getBalance", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalance", arg); return reply.ToObjects(this.Converter); } public async Task> GetBalances() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "getBalances", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalances", arg); return reply.ToObjects>(this.Converter); } @@ -111,8 +108,7 @@ namespace Test public async Task Whoami() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "whoami", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "whoami", arg); return reply.ToObjects(this.Converter); } diff --git a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap index c27ed437..3359d2f7 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap @@ -52,24 +52,21 @@ namespace Test public async Task> GetAllBalances() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "getAllBalances", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getAllBalances", arg); return reply.ToObjects>(this.Converter); } public async Task GetBalance(Token arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "getBalance", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalance", arg); return reply.ToObjects(this.Converter); } public async Task> GetBalances() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "getBalances", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalances", arg); return reply.ToObjects>(this.Converter); } @@ -111,8 +108,7 @@ namespace Test public async Task Whoami() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "whoami", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "whoami", arg); return reply.ToObjects(this.Converter); } diff --git a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap index 48ba6484..73343a16 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap @@ -52,24 +52,21 @@ namespace Test public async Task> getAllBalances() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "getAllBalances", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getAllBalances", arg); return reply.ToObjects>(this.Converter); } public async Task getBalance(Token arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "getBalance", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalance", arg); return reply.ToObjects(this.Converter); } public async Task> getBalances() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "getBalances", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalances", arg); return reply.ToObjects>(this.Converter); } @@ -111,8 +108,7 @@ namespace Test public async Task whoami() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "whoami", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "whoami", arg); return reply.ToObjects(this.Converter); } diff --git a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap index e9a99ba6..eea04b99 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap @@ -52,24 +52,21 @@ namespace Test public async Task> getAllBalances() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "getAllBalances", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getAllBalances", arg); return reply.ToObjects>(this.Converter); } public async Task getBalance(Token arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "getBalance", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalance", arg); return reply.ToObjects(this.Converter); } public async Task> getBalances() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "getBalances", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalances", arg); return reply.ToObjects>(this.Converter); } @@ -111,8 +108,7 @@ namespace Test public async Task whoami() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "whoami", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "whoami", arg); return reply.ToObjects(this.Converter); } diff --git a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap index 63d1c957..eacfd549 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap @@ -52,24 +52,21 @@ namespace Test public async Task> getAllBalances() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "getAllBalances", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getAllBalances", arg); return reply.ToObjects>(this.Converter); } public async Task getBalance(Token arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "getBalance", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalance", arg); return reply.ToObjects(this.Converter); } public async Task> getBalances() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "getBalances", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalances", arg); return reply.ToObjects>(this.Converter); } @@ -111,8 +108,7 @@ namespace Test public async Task whoami() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "whoami", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "whoami", arg); return reply.ToObjects(this.Converter); } diff --git a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap index 0d2a2209..c895cd0b 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap @@ -52,24 +52,21 @@ namespace Test public async Task> getAllBalances() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "getAllBalances", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getAllBalances", arg); return reply.ToObjects>(this.Converter); } public async Task getBalance(Token arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "getBalance", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalance", arg); return reply.ToObjects(this.Converter); } public async Task> getBalances() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "getBalances", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalances", arg); return reply.ToObjects>(this.Converter); } @@ -111,8 +108,7 @@ namespace Test public async Task whoami() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "whoami", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "whoami", arg); return reply.ToObjects(this.Converter); } diff --git a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap index c62edfb7..36f86e7c 100644 --- a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap @@ -23,8 +23,7 @@ namespace Test public async Task A() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "a", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap index c62edfb7..36f86e7c 100644 --- a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap @@ -23,8 +23,7 @@ namespace Test public async Task A() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "a", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap index c62edfb7..36f86e7c 100644 --- a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap @@ -23,8 +23,7 @@ namespace Test public async Task A() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "a", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap index c62edfb7..36f86e7c 100644 --- a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap @@ -23,8 +23,7 @@ namespace Test public async Task A() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "a", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap index 088aedad..33a5c9d0 100644 --- a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap @@ -23,8 +23,7 @@ namespace Test public async Task a() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "a", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap index 088aedad..33a5c9d0 100644 --- a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap @@ -23,8 +23,7 @@ namespace Test public async Task a() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "a", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap index 088aedad..33a5c9d0 100644 --- a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap @@ -23,8 +23,7 @@ namespace Test public async Task a() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "a", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap index 088aedad..33a5c9d0 100644 --- a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap @@ -23,8 +23,7 @@ namespace Test public async Task a() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "a", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap index 4808cb55..df1f8c55 100644 --- a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap @@ -23,8 +23,7 @@ namespace Test public async Task A() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "a", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap index 4808cb55..df1f8c55 100644 --- a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap @@ -23,8 +23,7 @@ namespace Test public async Task A() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "a", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap index 4808cb55..df1f8c55 100644 --- a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap @@ -23,8 +23,7 @@ namespace Test public async Task A() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "a", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap index 4808cb55..df1f8c55 100644 --- a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap @@ -23,8 +23,7 @@ namespace Test public async Task A() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "a", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap index 4d42ec0e..4a87f2e4 100644 --- a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap @@ -23,8 +23,7 @@ namespace Test public async Task a() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "a", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap index 4d42ec0e..4a87f2e4 100644 --- a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap @@ -23,8 +23,7 @@ namespace Test public async Task a() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "a", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap index 4d42ec0e..4a87f2e4 100644 --- a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap @@ -23,8 +23,7 @@ namespace Test public async Task a() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "a", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap index 4d42ec0e..4a87f2e4 100644 --- a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap @@ -23,8 +23,7 @@ namespace Test public async Task a() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "a", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap index 31884c7f..7e05167e 100644 --- a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap @@ -23,8 +23,7 @@ namespace Test public async Task A() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "a", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap index 31884c7f..7e05167e 100644 --- a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap @@ -23,8 +23,7 @@ namespace Test public async Task A() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "a", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap index 31884c7f..7e05167e 100644 --- a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap @@ -23,8 +23,7 @@ namespace Test public async Task A() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "a", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap index 31884c7f..7e05167e 100644 --- a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap @@ -23,8 +23,7 @@ namespace Test public async Task A() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "a", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap index e5c86da4..f74b8ecb 100644 --- a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap @@ -23,8 +23,7 @@ namespace Test public async Task a() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "a", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap index e5c86da4..f74b8ecb 100644 --- a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap @@ -23,8 +23,7 @@ namespace Test public async Task a() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "a", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap index e5c86da4..f74b8ecb 100644 --- a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap @@ -23,8 +23,7 @@ namespace Test public async Task a() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "a", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap index e5c86da4..f74b8ecb 100644 --- a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap @@ -23,8 +23,7 @@ namespace Test public async Task a() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "a", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap index 2fcbbc30..423af5b2 100644 --- a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap @@ -23,8 +23,7 @@ namespace Test public async Task A() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "a", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap index 2fcbbc30..423af5b2 100644 --- a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap @@ -23,8 +23,7 @@ namespace Test public async Task A() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "a", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap index 2fcbbc30..423af5b2 100644 --- a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap @@ -23,8 +23,7 @@ namespace Test public async Task A() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "a", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap index 2fcbbc30..423af5b2 100644 --- a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap @@ -23,8 +23,7 @@ namespace Test public async Task A() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "a", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap index 3c3cc579..740ec9d5 100644 --- a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap @@ -23,8 +23,7 @@ namespace Test public async Task a() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "a", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap index 3c3cc579..740ec9d5 100644 --- a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap @@ -23,8 +23,7 @@ namespace Test public async Task a() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "a", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap index 3c3cc579..740ec9d5 100644 --- a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap @@ -23,8 +23,7 @@ namespace Test public async Task a() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "a", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap index 3c3cc579..740ec9d5 100644 --- a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap @@ -23,8 +23,7 @@ namespace Test public async Task a() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "a", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap index 1535f04f..0896079b 100644 --- a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap @@ -23,8 +23,7 @@ namespace Test public async Task A() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "a", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap index 1535f04f..0896079b 100644 --- a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap @@ -23,8 +23,7 @@ namespace Test public async Task A() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "a", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap index 1535f04f..0896079b 100644 --- a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap @@ -23,8 +23,7 @@ namespace Test public async Task A() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "a", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap index 1535f04f..0896079b 100644 --- a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap @@ -23,8 +23,7 @@ namespace Test public async Task A() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "a", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap index 8c31bf53..321a0502 100644 --- a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap @@ -23,8 +23,7 @@ namespace Test public async Task a() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "a", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap index 8c31bf53..321a0502 100644 --- a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap @@ -23,8 +23,7 @@ namespace Test public async Task a() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "a", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap index 8c31bf53..321a0502 100644 --- a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap @@ -23,8 +23,7 @@ namespace Test public async Task a() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "a", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap index 8c31bf53..321a0502 100644 --- a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap @@ -23,8 +23,7 @@ namespace Test public async Task a() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "a", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap index 1e6b5e50..e08c189b 100644 --- a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap @@ -23,8 +23,7 @@ namespace Test public async Task A() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "a", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap index 1e6b5e50..e08c189b 100644 --- a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap @@ -23,8 +23,7 @@ namespace Test public async Task A() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "a", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap index 1e6b5e50..e08c189b 100644 --- a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap @@ -23,8 +23,7 @@ namespace Test public async Task A() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "a", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap index 1e6b5e50..e08c189b 100644 --- a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap @@ -23,8 +23,7 @@ namespace Test public async Task A() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "a", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap index 01ada2dd..42f17f69 100644 --- a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap @@ -23,8 +23,7 @@ namespace Test public async Task a() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "a", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap index 01ada2dd..42f17f69 100644 --- a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap @@ -23,8 +23,7 @@ namespace Test public async Task a() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "a", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap index 01ada2dd..42f17f69 100644 --- a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap @@ -23,8 +23,7 @@ namespace Test public async Task a() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "a", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap index 01ada2dd..42f17f69 100644 --- a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap @@ -23,8 +23,7 @@ namespace Test public async Task a() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "a", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap index fd402d60..4b5d0600 100644 --- a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap @@ -23,8 +23,7 @@ namespace Test public async Task A() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "a", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap index fd402d60..4b5d0600 100644 --- a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap @@ -23,8 +23,7 @@ namespace Test public async Task A() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "a", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap index fd402d60..4b5d0600 100644 --- a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap @@ -23,8 +23,7 @@ namespace Test public async Task A() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "a", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap index fd402d60..4b5d0600 100644 --- a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap @@ -23,8 +23,7 @@ namespace Test public async Task A() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "a", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap index 6ea78ea5..8612a26a 100644 --- a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap @@ -23,8 +23,7 @@ namespace Test public async Task a() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "a", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap index 6ea78ea5..8612a26a 100644 --- a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap @@ -23,8 +23,7 @@ namespace Test public async Task a() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "a", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap index 6ea78ea5..8612a26a 100644 --- a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap @@ -23,8 +23,7 @@ namespace Test public async Task a() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "a", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap index 6ea78ea5..8612a26a 100644 --- a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap @@ -23,8 +23,7 @@ namespace Test public async Task a() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "a", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap index c494782a..e0ecf0ab 100644 --- a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap @@ -23,8 +23,7 @@ namespace Test public async Task A() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "a", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap index c494782a..e0ecf0ab 100644 --- a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap @@ -23,8 +23,7 @@ namespace Test public async Task A() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "a", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap index c494782a..e0ecf0ab 100644 --- a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap @@ -23,8 +23,7 @@ namespace Test public async Task A() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "a", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap index c494782a..e0ecf0ab 100644 --- a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap @@ -23,8 +23,7 @@ namespace Test public async Task A() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "a", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap index d52868ad..94d5d444 100644 --- a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap @@ -23,8 +23,7 @@ namespace Test public async Task a() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "a", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap index d52868ad..94d5d444 100644 --- a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap @@ -23,8 +23,7 @@ namespace Test public async Task a() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "a", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap index d52868ad..94d5d444 100644 --- a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap @@ -23,8 +23,7 @@ namespace Test public async Task a() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "a", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap index d52868ad..94d5d444 100644 --- a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap @@ -23,8 +23,7 @@ namespace Test public async Task a() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "a", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap index c35b6cd2..ea3df0b6 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap @@ -38,24 +38,21 @@ namespace Test public async Task GetBuildMetadata() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_build_metadata", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_build_metadata", arg); return reply.ToObjects(this.Converter); } public async Task GetFullNeuron(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron", arg); return reply.ToObjects(this.Converter); } public async Task GetFullNeuronByIdOrSubaccount(Models.NeuronIdOrSubaccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron_by_id_or_subaccount", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron_by_id_or_subaccount", arg); return reply.ToObjects(this.Converter); } @@ -69,88 +66,77 @@ namespace Test public async Task GetNetworkEconomicsParameters() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_network_economics_parameters", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_network_economics_parameters", arg); return reply.ToObjects(this.Converter); } public async Task> GetNeuronIds() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_ids", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_ids", arg); return reply.ToObjects>(this.Converter); } public async Task GetNeuronInfo(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info", arg); return reply.ToObjects(this.Converter); } public async Task GetNeuronInfoByIdOrSubaccount(Models.NeuronIdOrSubaccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info_by_id_or_subaccount", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info_by_id_or_subaccount", arg); return reply.ToObjects(this.Converter); } public async Task GetNodeProviderByCaller(NullValue arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_node_provider_by_caller", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_node_provider_by_caller", arg); return reply.ToObjects(this.Converter); } public async Task> GetPendingProposals() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_pending_proposals", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_pending_proposals", arg); return reply.ToObjects>(this.Converter); } public async Task> GetProposalInfo(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_proposal_info", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_proposal_info", arg); return reply.ToObjects>(this.Converter); } public async Task ListKnownNeurons() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_known_neurons", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_known_neurons", arg); return reply.ToObjects(this.Converter); } public async Task ListNeurons(Models.ListNeurons arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_neurons", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_neurons", arg); return reply.ToObjects(this.Converter); } public async Task ListNodeProviders() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_node_providers", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_node_providers", arg); return reply.ToObjects(this.Converter); } public async Task ListProposals(Models.ListProposalInfo arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_proposals", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_proposals", arg); return reply.ToObjects(this.Converter); } diff --git a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap index dc29dab1..1f52b927 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap @@ -38,24 +38,21 @@ namespace Test public async Task GetBuildMetadata() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_build_metadata", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_build_metadata", arg); return reply.ToObjects(this.Converter); } public async Task GetFullNeuron(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron", arg); return reply.ToObjects(this.Converter); } public async Task GetFullNeuronByIdOrSubaccount(Models.NeuronIdOrSubaccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron_by_id_or_subaccount", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron_by_id_or_subaccount", arg); return reply.ToObjects(this.Converter); } @@ -69,88 +66,77 @@ namespace Test public async Task GetNetworkEconomicsParameters() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_network_economics_parameters", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_network_economics_parameters", arg); return reply.ToObjects(this.Converter); } public async Task> GetNeuronIds() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_ids", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_ids", arg); return reply.ToObjects>(this.Converter); } public async Task GetNeuronInfo(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info", arg); return reply.ToObjects(this.Converter); } public async Task GetNeuronInfoByIdOrSubaccount(Models.NeuronIdOrSubaccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info_by_id_or_subaccount", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info_by_id_or_subaccount", arg); return reply.ToObjects(this.Converter); } public async Task GetNodeProviderByCaller(NullValue arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_node_provider_by_caller", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_node_provider_by_caller", arg); return reply.ToObjects(this.Converter); } public async Task> GetPendingProposals() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_pending_proposals", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_pending_proposals", arg); return reply.ToObjects>(this.Converter); } public async Task> GetProposalInfo(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_proposal_info", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_proposal_info", arg); return reply.ToObjects>(this.Converter); } public async Task ListKnownNeurons() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_known_neurons", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_known_neurons", arg); return reply.ToObjects(this.Converter); } public async Task ListNeurons(Models.ListNeurons arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_neurons", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_neurons", arg); return reply.ToObjects(this.Converter); } public async Task ListNodeProviders() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_node_providers", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_node_providers", arg); return reply.ToObjects(this.Converter); } public async Task ListProposals(Models.ListProposalInfo arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_proposals", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_proposals", arg); return reply.ToObjects(this.Converter); } diff --git a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap index 5e8570fc..a021faa7 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap @@ -38,24 +38,21 @@ namespace Test public async Task GetBuildMetadata() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_build_metadata", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_build_metadata", arg); return reply.ToObjects(this.Converter); } public async Task GetFullNeuron(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron", arg); return reply.ToObjects(this.Converter); } public async Task GetFullNeuronByIdOrSubaccount(Models.NeuronIdOrSubaccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron_by_id_or_subaccount", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron_by_id_or_subaccount", arg); return reply.ToObjects(this.Converter); } @@ -69,88 +66,77 @@ namespace Test public async Task GetNetworkEconomicsParameters() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_network_economics_parameters", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_network_economics_parameters", arg); return reply.ToObjects(this.Converter); } public async Task> GetNeuronIds() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_ids", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_ids", arg); return reply.ToObjects>(this.Converter); } public async Task GetNeuronInfo(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info", arg); return reply.ToObjects(this.Converter); } public async Task GetNeuronInfoByIdOrSubaccount(Models.NeuronIdOrSubaccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info_by_id_or_subaccount", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info_by_id_or_subaccount", arg); return reply.ToObjects(this.Converter); } public async Task GetNodeProviderByCaller(NullValue arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_node_provider_by_caller", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_node_provider_by_caller", arg); return reply.ToObjects(this.Converter); } public async Task> GetPendingProposals() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_pending_proposals", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_pending_proposals", arg); return reply.ToObjects>(this.Converter); } public async Task> GetProposalInfo(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_proposal_info", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_proposal_info", arg); return reply.ToObjects>(this.Converter); } public async Task ListKnownNeurons() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_known_neurons", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_known_neurons", arg); return reply.ToObjects(this.Converter); } public async Task ListNeurons(Models.ListNeurons arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_neurons", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_neurons", arg); return reply.ToObjects(this.Converter); } public async Task ListNodeProviders() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_node_providers", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_node_providers", arg); return reply.ToObjects(this.Converter); } public async Task ListProposals(Models.ListProposalInfo arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_proposals", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_proposals", arg); return reply.ToObjects(this.Converter); } diff --git a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap index 8ea32c82..628ca552 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap @@ -38,24 +38,21 @@ namespace Test public async Task GetBuildMetadata() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_build_metadata", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_build_metadata", arg); return reply.ToObjects(this.Converter); } public async Task GetFullNeuron(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron", arg); return reply.ToObjects(this.Converter); } public async Task GetFullNeuronByIdOrSubaccount(Models.NeuronIdOrSubaccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron_by_id_or_subaccount", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron_by_id_or_subaccount", arg); return reply.ToObjects(this.Converter); } @@ -69,88 +66,77 @@ namespace Test public async Task GetNetworkEconomicsParameters() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_network_economics_parameters", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_network_economics_parameters", arg); return reply.ToObjects(this.Converter); } public async Task> GetNeuronIds() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_ids", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_ids", arg); return reply.ToObjects>(this.Converter); } public async Task GetNeuronInfo(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info", arg); return reply.ToObjects(this.Converter); } public async Task GetNeuronInfoByIdOrSubaccount(Models.NeuronIdOrSubaccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info_by_id_or_subaccount", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info_by_id_or_subaccount", arg); return reply.ToObjects(this.Converter); } public async Task GetNodeProviderByCaller(NullValue arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_node_provider_by_caller", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_node_provider_by_caller", arg); return reply.ToObjects(this.Converter); } public async Task> GetPendingProposals() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_pending_proposals", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_pending_proposals", arg); return reply.ToObjects>(this.Converter); } public async Task> GetProposalInfo(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_proposal_info", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_proposal_info", arg); return reply.ToObjects>(this.Converter); } public async Task ListKnownNeurons() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_known_neurons", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_known_neurons", arg); return reply.ToObjects(this.Converter); } public async Task ListNeurons(Models.ListNeurons arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_neurons", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_neurons", arg); return reply.ToObjects(this.Converter); } public async Task ListNodeProviders() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_node_providers", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_node_providers", arg); return reply.ToObjects(this.Converter); } public async Task ListProposals(Models.ListProposalInfo arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_proposals", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_proposals", arg); return reply.ToObjects(this.Converter); } diff --git a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap index 2501f9c6..d72dc1b9 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap @@ -38,24 +38,21 @@ namespace Test public async Task _get_build_metadata() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_build_metadata", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_build_metadata", arg); return reply.ToObjects(this.Converter); } public async Task _get_full_neuron(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron", arg); return reply.ToObjects(this.Converter); } public async Task _get_full_neuron_by_id_or_subaccount(Models.NeuronIdOrSubaccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron_by_id_or_subaccount", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron_by_id_or_subaccount", arg); return reply.ToObjects(this.Converter); } @@ -69,88 +66,77 @@ namespace Test public async Task _get_network_economics_parameters() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_network_economics_parameters", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_network_economics_parameters", arg); return reply.ToObjects(this.Converter); } public async Task> _get_neuron_ids() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_ids", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_ids", arg); return reply.ToObjects>(this.Converter); } public async Task _get_neuron_info(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info", arg); return reply.ToObjects(this.Converter); } public async Task _get_neuron_info_by_id_or_subaccount(Models.NeuronIdOrSubaccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info_by_id_or_subaccount", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info_by_id_or_subaccount", arg); return reply.ToObjects(this.Converter); } public async Task _get_node_provider_by_caller(NullValue arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_node_provider_by_caller", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_node_provider_by_caller", arg); return reply.ToObjects(this.Converter); } public async Task> _get_pending_proposals() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_pending_proposals", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_pending_proposals", arg); return reply.ToObjects>(this.Converter); } public async Task> _get_proposal_info(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_proposal_info", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_proposal_info", arg); return reply.ToObjects>(this.Converter); } public async Task list_known_neurons() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_known_neurons", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_known_neurons", arg); return reply.ToObjects(this.Converter); } public async Task list_neurons(Models.ListNeurons arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_neurons", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_neurons", arg); return reply.ToObjects(this.Converter); } public async Task list_node_providers() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_node_providers", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_node_providers", arg); return reply.ToObjects(this.Converter); } public async Task list_proposals(Models.ListProposalInfo arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_proposals", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_proposals", arg); return reply.ToObjects(this.Converter); } diff --git a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap index 5394b01a..71fcc883 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap @@ -38,24 +38,21 @@ namespace Test public async Task _get_build_metadata() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_build_metadata", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_build_metadata", arg); return reply.ToObjects(this.Converter); } public async Task _get_full_neuron(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron", arg); return reply.ToObjects(this.Converter); } public async Task _get_full_neuron_by_id_or_subaccount(Models.NeuronIdOrSubaccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron_by_id_or_subaccount", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron_by_id_or_subaccount", arg); return reply.ToObjects(this.Converter); } @@ -69,88 +66,77 @@ namespace Test public async Task _get_network_economics_parameters() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_network_economics_parameters", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_network_economics_parameters", arg); return reply.ToObjects(this.Converter); } public async Task> _get_neuron_ids() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_ids", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_ids", arg); return reply.ToObjects>(this.Converter); } public async Task _get_neuron_info(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info", arg); return reply.ToObjects(this.Converter); } public async Task _get_neuron_info_by_id_or_subaccount(Models.NeuronIdOrSubaccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info_by_id_or_subaccount", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info_by_id_or_subaccount", arg); return reply.ToObjects(this.Converter); } public async Task _get_node_provider_by_caller(NullValue arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_node_provider_by_caller", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_node_provider_by_caller", arg); return reply.ToObjects(this.Converter); } public async Task> _get_pending_proposals() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_pending_proposals", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_pending_proposals", arg); return reply.ToObjects>(this.Converter); } public async Task> _get_proposal_info(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_proposal_info", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_proposal_info", arg); return reply.ToObjects>(this.Converter); } public async Task list_known_neurons() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_known_neurons", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_known_neurons", arg); return reply.ToObjects(this.Converter); } public async Task list_neurons(Models.ListNeurons arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_neurons", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_neurons", arg); return reply.ToObjects(this.Converter); } public async Task list_node_providers() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_node_providers", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_node_providers", arg); return reply.ToObjects(this.Converter); } public async Task list_proposals(Models.ListProposalInfo arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_proposals", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_proposals", arg); return reply.ToObjects(this.Converter); } diff --git a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap index f42d95b0..4016458a 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap @@ -38,24 +38,21 @@ namespace Test public async Task _get_build_metadata() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_build_metadata", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_build_metadata", arg); return reply.ToObjects(this.Converter); } public async Task _get_full_neuron(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron", arg); return reply.ToObjects(this.Converter); } public async Task _get_full_neuron_by_id_or_subaccount(Models.NeuronIdOrSubaccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron_by_id_or_subaccount", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron_by_id_or_subaccount", arg); return reply.ToObjects(this.Converter); } @@ -69,88 +66,77 @@ namespace Test public async Task _get_network_economics_parameters() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_network_economics_parameters", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_network_economics_parameters", arg); return reply.ToObjects(this.Converter); } public async Task> _get_neuron_ids() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_ids", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_ids", arg); return reply.ToObjects>(this.Converter); } public async Task _get_neuron_info(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info", arg); return reply.ToObjects(this.Converter); } public async Task _get_neuron_info_by_id_or_subaccount(Models.NeuronIdOrSubaccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info_by_id_or_subaccount", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info_by_id_or_subaccount", arg); return reply.ToObjects(this.Converter); } public async Task _get_node_provider_by_caller(NullValue arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_node_provider_by_caller", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_node_provider_by_caller", arg); return reply.ToObjects(this.Converter); } public async Task> _get_pending_proposals() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_pending_proposals", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_pending_proposals", arg); return reply.ToObjects>(this.Converter); } public async Task> _get_proposal_info(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_proposal_info", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_proposal_info", arg); return reply.ToObjects>(this.Converter); } public async Task list_known_neurons() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_known_neurons", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_known_neurons", arg); return reply.ToObjects(this.Converter); } public async Task list_neurons(Models.ListNeurons arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_neurons", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_neurons", arg); return reply.ToObjects(this.Converter); } public async Task list_node_providers() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_node_providers", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_node_providers", arg); return reply.ToObjects(this.Converter); } public async Task list_proposals(Models.ListProposalInfo arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_proposals", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_proposals", arg); return reply.ToObjects(this.Converter); } diff --git a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap index a8d4fcec..f9ef8079 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap @@ -38,24 +38,21 @@ namespace Test public async Task _get_build_metadata() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_build_metadata", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_build_metadata", arg); return reply.ToObjects(this.Converter); } public async Task _get_full_neuron(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron", arg); return reply.ToObjects(this.Converter); } public async Task _get_full_neuron_by_id_or_subaccount(Models.NeuronIdOrSubaccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron_by_id_or_subaccount", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron_by_id_or_subaccount", arg); return reply.ToObjects(this.Converter); } @@ -69,88 +66,77 @@ namespace Test public async Task _get_network_economics_parameters() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_network_economics_parameters", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_network_economics_parameters", arg); return reply.ToObjects(this.Converter); } public async Task> _get_neuron_ids() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_ids", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_ids", arg); return reply.ToObjects>(this.Converter); } public async Task _get_neuron_info(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info", arg); return reply.ToObjects(this.Converter); } public async Task _get_neuron_info_by_id_or_subaccount(Models.NeuronIdOrSubaccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info_by_id_or_subaccount", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info_by_id_or_subaccount", arg); return reply.ToObjects(this.Converter); } public async Task _get_node_provider_by_caller(NullValue arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_node_provider_by_caller", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_node_provider_by_caller", arg); return reply.ToObjects(this.Converter); } public async Task> _get_pending_proposals() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_pending_proposals", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_pending_proposals", arg); return reply.ToObjects>(this.Converter); } public async Task> _get_proposal_info(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_proposal_info", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_proposal_info", arg); return reply.ToObjects>(this.Converter); } public async Task list_known_neurons() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_known_neurons", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_known_neurons", arg); return reply.ToObjects(this.Converter); } public async Task list_neurons(Models.ListNeurons arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_neurons", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_neurons", arg); return reply.ToObjects(this.Converter); } public async Task list_node_providers() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_node_providers", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_node_providers", arg); return reply.ToObjects(this.Converter); } public async Task list_proposals(Models.ListProposalInfo arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_proposals", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_proposals", arg); return reply.ToObjects(this.Converter); } diff --git a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap index aa139e93..c708c84f 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap @@ -38,24 +38,21 @@ namespace Test public async Task GetBuildMetadata() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_build_metadata", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_build_metadata", arg); return reply.ToObjects(this.Converter); } public async Task GetFullNeuron(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron", arg); return reply.ToObjects(this.Converter); } public async Task GetFullNeuronByIdOrSubaccount(Models.NeuronIdOrSubaccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron_by_id_or_subaccount", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron_by_id_or_subaccount", arg); return reply.ToObjects(this.Converter); } @@ -69,88 +66,77 @@ namespace Test public async Task GetNetworkEconomicsParameters() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_network_economics_parameters", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_network_economics_parameters", arg); return reply.ToObjects(this.Converter); } public async Task> GetNeuronIds() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_ids", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_ids", arg); return reply.ToObjects>(this.Converter); } public async Task GetNeuronInfo(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info", arg); return reply.ToObjects(this.Converter); } public async Task GetNeuronInfoByIdOrSubaccount(Models.NeuronIdOrSubaccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info_by_id_or_subaccount", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info_by_id_or_subaccount", arg); return reply.ToObjects(this.Converter); } public async Task GetNodeProviderByCaller(NullValue arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_node_provider_by_caller", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_node_provider_by_caller", arg); return reply.ToObjects(this.Converter); } public async Task> GetPendingProposals() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_pending_proposals", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_pending_proposals", arg); return reply.ToObjects>(this.Converter); } public async Task> GetProposalInfo(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_proposal_info", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_proposal_info", arg); return reply.ToObjects>(this.Converter); } public async Task ListKnownNeurons() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_known_neurons", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_known_neurons", arg); return reply.ToObjects(this.Converter); } public async Task ListNeurons(Models.ListNeurons arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_neurons", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_neurons", arg); return reply.ToObjects(this.Converter); } public async Task ListNodeProviders() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_node_providers", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_node_providers", arg); return reply.ToObjects(this.Converter); } public async Task ListProposals(Models.ListProposalInfo arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_proposals", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_proposals", arg); return reply.ToObjects(this.Converter); } diff --git a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap index 4a42d8a2..b83fc9aa 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap @@ -38,24 +38,21 @@ namespace Test public async Task GetBuildMetadata() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_build_metadata", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_build_metadata", arg); return reply.ToObjects(this.Converter); } public async Task GetFullNeuron(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron", arg); return reply.ToObjects(this.Converter); } public async Task GetFullNeuronByIdOrSubaccount(Models.NeuronIdOrSubaccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron_by_id_or_subaccount", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron_by_id_or_subaccount", arg); return reply.ToObjects(this.Converter); } @@ -69,88 +66,77 @@ namespace Test public async Task GetNetworkEconomicsParameters() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_network_economics_parameters", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_network_economics_parameters", arg); return reply.ToObjects(this.Converter); } public async Task> GetNeuronIds() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_ids", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_ids", arg); return reply.ToObjects>(this.Converter); } public async Task GetNeuronInfo(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info", arg); return reply.ToObjects(this.Converter); } public async Task GetNeuronInfoByIdOrSubaccount(Models.NeuronIdOrSubaccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info_by_id_or_subaccount", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info_by_id_or_subaccount", arg); return reply.ToObjects(this.Converter); } public async Task GetNodeProviderByCaller(NullValue arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_node_provider_by_caller", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_node_provider_by_caller", arg); return reply.ToObjects(this.Converter); } public async Task> GetPendingProposals() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_pending_proposals", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_pending_proposals", arg); return reply.ToObjects>(this.Converter); } public async Task> GetProposalInfo(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_proposal_info", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_proposal_info", arg); return reply.ToObjects>(this.Converter); } public async Task ListKnownNeurons() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_known_neurons", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_known_neurons", arg); return reply.ToObjects(this.Converter); } public async Task ListNeurons(Models.ListNeurons arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_neurons", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_neurons", arg); return reply.ToObjects(this.Converter); } public async Task ListNodeProviders() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_node_providers", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_node_providers", arg); return reply.ToObjects(this.Converter); } public async Task ListProposals(Models.ListProposalInfo arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_proposals", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_proposals", arg); return reply.ToObjects(this.Converter); } diff --git a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap index 8939a7df..fd38e2c1 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap @@ -38,24 +38,21 @@ namespace Test public async Task GetBuildMetadata() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_build_metadata", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_build_metadata", arg); return reply.ToObjects(this.Converter); } public async Task GetFullNeuron(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron", arg); return reply.ToObjects(this.Converter); } public async Task GetFullNeuronByIdOrSubaccount(Models.NeuronIdOrSubaccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron_by_id_or_subaccount", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron_by_id_or_subaccount", arg); return reply.ToObjects(this.Converter); } @@ -69,88 +66,77 @@ namespace Test public async Task GetNetworkEconomicsParameters() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_network_economics_parameters", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_network_economics_parameters", arg); return reply.ToObjects(this.Converter); } public async Task> GetNeuronIds() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_ids", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_ids", arg); return reply.ToObjects>(this.Converter); } public async Task GetNeuronInfo(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info", arg); return reply.ToObjects(this.Converter); } public async Task GetNeuronInfoByIdOrSubaccount(Models.NeuronIdOrSubaccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info_by_id_or_subaccount", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info_by_id_or_subaccount", arg); return reply.ToObjects(this.Converter); } public async Task GetNodeProviderByCaller(NullValue arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_node_provider_by_caller", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_node_provider_by_caller", arg); return reply.ToObjects(this.Converter); } public async Task> GetPendingProposals() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_pending_proposals", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_pending_proposals", arg); return reply.ToObjects>(this.Converter); } public async Task> GetProposalInfo(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_proposal_info", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_proposal_info", arg); return reply.ToObjects>(this.Converter); } public async Task ListKnownNeurons() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_known_neurons", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_known_neurons", arg); return reply.ToObjects(this.Converter); } public async Task ListNeurons(Models.ListNeurons arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_neurons", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_neurons", arg); return reply.ToObjects(this.Converter); } public async Task ListNodeProviders() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_node_providers", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_node_providers", arg); return reply.ToObjects(this.Converter); } public async Task ListProposals(Models.ListProposalInfo arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_proposals", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_proposals", arg); return reply.ToObjects(this.Converter); } diff --git a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap index 1897952a..a863f1eb 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap @@ -38,24 +38,21 @@ namespace Test public async Task GetBuildMetadata() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_build_metadata", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_build_metadata", arg); return reply.ToObjects(this.Converter); } public async Task GetFullNeuron(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron", arg); return reply.ToObjects(this.Converter); } public async Task GetFullNeuronByIdOrSubaccount(Models.NeuronIdOrSubaccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron_by_id_or_subaccount", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron_by_id_or_subaccount", arg); return reply.ToObjects(this.Converter); } @@ -69,88 +66,77 @@ namespace Test public async Task GetNetworkEconomicsParameters() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_network_economics_parameters", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_network_economics_parameters", arg); return reply.ToObjects(this.Converter); } public async Task> GetNeuronIds() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_ids", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_ids", arg); return reply.ToObjects>(this.Converter); } public async Task GetNeuronInfo(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info", arg); return reply.ToObjects(this.Converter); } public async Task GetNeuronInfoByIdOrSubaccount(Models.NeuronIdOrSubaccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info_by_id_or_subaccount", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info_by_id_or_subaccount", arg); return reply.ToObjects(this.Converter); } public async Task GetNodeProviderByCaller(NullValue arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_node_provider_by_caller", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_node_provider_by_caller", arg); return reply.ToObjects(this.Converter); } public async Task> GetPendingProposals() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_pending_proposals", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_pending_proposals", arg); return reply.ToObjects>(this.Converter); } public async Task> GetProposalInfo(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_proposal_info", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_proposal_info", arg); return reply.ToObjects>(this.Converter); } public async Task ListKnownNeurons() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_known_neurons", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_known_neurons", arg); return reply.ToObjects(this.Converter); } public async Task ListNeurons(Models.ListNeurons arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_neurons", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_neurons", arg); return reply.ToObjects(this.Converter); } public async Task ListNodeProviders() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_node_providers", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_node_providers", arg); return reply.ToObjects(this.Converter); } public async Task ListProposals(Models.ListProposalInfo arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_proposals", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_proposals", arg); return reply.ToObjects(this.Converter); } diff --git a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap index 4c244a40..c3f7a5cd 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap @@ -38,24 +38,21 @@ namespace Test public async Task _get_build_metadata() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_build_metadata", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_build_metadata", arg); return reply.ToObjects(this.Converter); } public async Task _get_full_neuron(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron", arg); return reply.ToObjects(this.Converter); } public async Task _get_full_neuron_by_id_or_subaccount(Models.NeuronIdOrSubaccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron_by_id_or_subaccount", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron_by_id_or_subaccount", arg); return reply.ToObjects(this.Converter); } @@ -69,88 +66,77 @@ namespace Test public async Task _get_network_economics_parameters() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_network_economics_parameters", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_network_economics_parameters", arg); return reply.ToObjects(this.Converter); } public async Task> _get_neuron_ids() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_ids", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_ids", arg); return reply.ToObjects>(this.Converter); } public async Task _get_neuron_info(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info", arg); return reply.ToObjects(this.Converter); } public async Task _get_neuron_info_by_id_or_subaccount(Models.NeuronIdOrSubaccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info_by_id_or_subaccount", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info_by_id_or_subaccount", arg); return reply.ToObjects(this.Converter); } public async Task _get_node_provider_by_caller(NullValue arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_node_provider_by_caller", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_node_provider_by_caller", arg); return reply.ToObjects(this.Converter); } public async Task> _get_pending_proposals() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_pending_proposals", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_pending_proposals", arg); return reply.ToObjects>(this.Converter); } public async Task> _get_proposal_info(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_proposal_info", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_proposal_info", arg); return reply.ToObjects>(this.Converter); } public async Task list_known_neurons() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_known_neurons", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_known_neurons", arg); return reply.ToObjects(this.Converter); } public async Task list_neurons(Models.ListNeurons arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_neurons", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_neurons", arg); return reply.ToObjects(this.Converter); } public async Task list_node_providers() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_node_providers", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_node_providers", arg); return reply.ToObjects(this.Converter); } public async Task list_proposals(Models.ListProposalInfo arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_proposals", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_proposals", arg); return reply.ToObjects(this.Converter); } diff --git a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap index dd31ccde..7393f2a3 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap @@ -38,24 +38,21 @@ namespace Test public async Task _get_build_metadata() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_build_metadata", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_build_metadata", arg); return reply.ToObjects(this.Converter); } public async Task _get_full_neuron(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron", arg); return reply.ToObjects(this.Converter); } public async Task _get_full_neuron_by_id_or_subaccount(Models.NeuronIdOrSubaccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron_by_id_or_subaccount", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron_by_id_or_subaccount", arg); return reply.ToObjects(this.Converter); } @@ -69,88 +66,77 @@ namespace Test public async Task _get_network_economics_parameters() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_network_economics_parameters", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_network_economics_parameters", arg); return reply.ToObjects(this.Converter); } public async Task> _get_neuron_ids() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_ids", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_ids", arg); return reply.ToObjects>(this.Converter); } public async Task _get_neuron_info(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info", arg); return reply.ToObjects(this.Converter); } public async Task _get_neuron_info_by_id_or_subaccount(Models.NeuronIdOrSubaccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info_by_id_or_subaccount", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info_by_id_or_subaccount", arg); return reply.ToObjects(this.Converter); } public async Task _get_node_provider_by_caller(NullValue arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_node_provider_by_caller", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_node_provider_by_caller", arg); return reply.ToObjects(this.Converter); } public async Task> _get_pending_proposals() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_pending_proposals", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_pending_proposals", arg); return reply.ToObjects>(this.Converter); } public async Task> _get_proposal_info(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_proposal_info", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_proposal_info", arg); return reply.ToObjects>(this.Converter); } public async Task list_known_neurons() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_known_neurons", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_known_neurons", arg); return reply.ToObjects(this.Converter); } public async Task list_neurons(Models.ListNeurons arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_neurons", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_neurons", arg); return reply.ToObjects(this.Converter); } public async Task list_node_providers() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_node_providers", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_node_providers", arg); return reply.ToObjects(this.Converter); } public async Task list_proposals(Models.ListProposalInfo arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_proposals", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_proposals", arg); return reply.ToObjects(this.Converter); } diff --git a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap index 03e1d8c2..8e9f96af 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap @@ -38,24 +38,21 @@ namespace Test public async Task _get_build_metadata() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_build_metadata", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_build_metadata", arg); return reply.ToObjects(this.Converter); } public async Task _get_full_neuron(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron", arg); return reply.ToObjects(this.Converter); } public async Task _get_full_neuron_by_id_or_subaccount(Models.NeuronIdOrSubaccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron_by_id_or_subaccount", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron_by_id_or_subaccount", arg); return reply.ToObjects(this.Converter); } @@ -69,88 +66,77 @@ namespace Test public async Task _get_network_economics_parameters() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_network_economics_parameters", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_network_economics_parameters", arg); return reply.ToObjects(this.Converter); } public async Task> _get_neuron_ids() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_ids", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_ids", arg); return reply.ToObjects>(this.Converter); } public async Task _get_neuron_info(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info", arg); return reply.ToObjects(this.Converter); } public async Task _get_neuron_info_by_id_or_subaccount(Models.NeuronIdOrSubaccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info_by_id_or_subaccount", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info_by_id_or_subaccount", arg); return reply.ToObjects(this.Converter); } public async Task _get_node_provider_by_caller(NullValue arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_node_provider_by_caller", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_node_provider_by_caller", arg); return reply.ToObjects(this.Converter); } public async Task> _get_pending_proposals() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_pending_proposals", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_pending_proposals", arg); return reply.ToObjects>(this.Converter); } public async Task> _get_proposal_info(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_proposal_info", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_proposal_info", arg); return reply.ToObjects>(this.Converter); } public async Task list_known_neurons() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_known_neurons", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_known_neurons", arg); return reply.ToObjects(this.Converter); } public async Task list_neurons(Models.ListNeurons arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_neurons", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_neurons", arg); return reply.ToObjects(this.Converter); } public async Task list_node_providers() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_node_providers", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_node_providers", arg); return reply.ToObjects(this.Converter); } public async Task list_proposals(Models.ListProposalInfo arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_proposals", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_proposals", arg); return reply.ToObjects(this.Converter); } diff --git a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap index 0f4d07df..22ac0597 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap @@ -38,24 +38,21 @@ namespace Test public async Task _get_build_metadata() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_build_metadata", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_build_metadata", arg); return reply.ToObjects(this.Converter); } public async Task _get_full_neuron(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron", arg); return reply.ToObjects(this.Converter); } public async Task _get_full_neuron_by_id_or_subaccount(Models.NeuronIdOrSubaccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron_by_id_or_subaccount", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron_by_id_or_subaccount", arg); return reply.ToObjects(this.Converter); } @@ -69,88 +66,77 @@ namespace Test public async Task _get_network_economics_parameters() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_network_economics_parameters", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_network_economics_parameters", arg); return reply.ToObjects(this.Converter); } public async Task> _get_neuron_ids() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_ids", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_ids", arg); return reply.ToObjects>(this.Converter); } public async Task _get_neuron_info(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info", arg); return reply.ToObjects(this.Converter); } public async Task _get_neuron_info_by_id_or_subaccount(Models.NeuronIdOrSubaccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info_by_id_or_subaccount", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info_by_id_or_subaccount", arg); return reply.ToObjects(this.Converter); } public async Task _get_node_provider_by_caller(NullValue arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_node_provider_by_caller", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_node_provider_by_caller", arg); return reply.ToObjects(this.Converter); } public async Task> _get_pending_proposals() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_pending_proposals", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_pending_proposals", arg); return reply.ToObjects>(this.Converter); } public async Task> _get_proposal_info(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_proposal_info", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_proposal_info", arg); return reply.ToObjects>(this.Converter); } public async Task list_known_neurons() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_known_neurons", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_known_neurons", arg); return reply.ToObjects(this.Converter); } public async Task list_neurons(Models.ListNeurons arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_neurons", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_neurons", arg); return reply.ToObjects(this.Converter); } public async Task list_node_providers() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_node_providers", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_node_providers", arg); return reply.ToObjects(this.Converter); } public async Task list_proposals(Models.ListProposalInfo arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_proposals", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_proposals", arg); return reply.ToObjects(this.Converter); } diff --git a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap index a9493163..cf3ec021 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap @@ -38,24 +38,21 @@ namespace Test public async Task GetBuildMetadata() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_build_metadata", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_build_metadata", arg); return reply.ToObjects(this.Converter); } public async Task GetFullNeuron(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron", arg); return reply.ToObjects(this.Converter); } public async Task GetFullNeuronByIdOrSubaccount(NeuronIdOrSubaccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron_by_id_or_subaccount", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron_by_id_or_subaccount", arg); return reply.ToObjects(this.Converter); } @@ -69,88 +66,77 @@ namespace Test public async Task GetNetworkEconomicsParameters() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_network_economics_parameters", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_network_economics_parameters", arg); return reply.ToObjects(this.Converter); } public async Task> GetNeuronIds() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_ids", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_ids", arg); return reply.ToObjects>(this.Converter); } public async Task GetNeuronInfo(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info", arg); return reply.ToObjects(this.Converter); } public async Task GetNeuronInfoByIdOrSubaccount(NeuronIdOrSubaccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info_by_id_or_subaccount", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info_by_id_or_subaccount", arg); return reply.ToObjects(this.Converter); } public async Task GetNodeProviderByCaller(NullValue arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_node_provider_by_caller", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_node_provider_by_caller", arg); return reply.ToObjects(this.Converter); } public async Task> GetPendingProposals() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_pending_proposals", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_pending_proposals", arg); return reply.ToObjects>(this.Converter); } public async Task> GetProposalInfo(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_proposal_info", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_proposal_info", arg); return reply.ToObjects>(this.Converter); } public async Task ListKnownNeurons() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_known_neurons", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_known_neurons", arg); return reply.ToObjects(this.Converter); } public async Task ListNeurons(ListNeurons arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_neurons", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_neurons", arg); return reply.ToObjects(this.Converter); } public async Task ListNodeProviders() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_node_providers", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_node_providers", arg); return reply.ToObjects(this.Converter); } public async Task ListProposals(ListProposalInfo arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_proposals", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_proposals", arg); return reply.ToObjects(this.Converter); } diff --git a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap index 99859da7..497bdc18 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap @@ -38,24 +38,21 @@ namespace Test public async Task GetBuildMetadata() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_build_metadata", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_build_metadata", arg); return reply.ToObjects(this.Converter); } public async Task GetFullNeuron(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron", arg); return reply.ToObjects(this.Converter); } public async Task GetFullNeuronByIdOrSubaccount(NeuronIdOrSubaccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron_by_id_or_subaccount", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron_by_id_or_subaccount", arg); return reply.ToObjects(this.Converter); } @@ -69,88 +66,77 @@ namespace Test public async Task GetNetworkEconomicsParameters() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_network_economics_parameters", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_network_economics_parameters", arg); return reply.ToObjects(this.Converter); } public async Task> GetNeuronIds() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_ids", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_ids", arg); return reply.ToObjects>(this.Converter); } public async Task GetNeuronInfo(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info", arg); return reply.ToObjects(this.Converter); } public async Task GetNeuronInfoByIdOrSubaccount(NeuronIdOrSubaccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info_by_id_or_subaccount", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info_by_id_or_subaccount", arg); return reply.ToObjects(this.Converter); } public async Task GetNodeProviderByCaller(NullValue arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_node_provider_by_caller", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_node_provider_by_caller", arg); return reply.ToObjects(this.Converter); } public async Task> GetPendingProposals() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_pending_proposals", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_pending_proposals", arg); return reply.ToObjects>(this.Converter); } public async Task> GetProposalInfo(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_proposal_info", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_proposal_info", arg); return reply.ToObjects>(this.Converter); } public async Task ListKnownNeurons() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_known_neurons", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_known_neurons", arg); return reply.ToObjects(this.Converter); } public async Task ListNeurons(ListNeurons arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_neurons", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_neurons", arg); return reply.ToObjects(this.Converter); } public async Task ListNodeProviders() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_node_providers", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_node_providers", arg); return reply.ToObjects(this.Converter); } public async Task ListProposals(ListProposalInfo arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_proposals", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_proposals", arg); return reply.ToObjects(this.Converter); } diff --git a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap index 4c1e89d9..03ae62c7 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap @@ -38,24 +38,21 @@ namespace Test public async Task GetBuildMetadata() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_build_metadata", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_build_metadata", arg); return reply.ToObjects(this.Converter); } public async Task GetFullNeuron(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron", arg); return reply.ToObjects(this.Converter); } public async Task GetFullNeuronByIdOrSubaccount(NeuronIdOrSubaccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron_by_id_or_subaccount", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron_by_id_or_subaccount", arg); return reply.ToObjects(this.Converter); } @@ -69,88 +66,77 @@ namespace Test public async Task GetNetworkEconomicsParameters() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_network_economics_parameters", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_network_economics_parameters", arg); return reply.ToObjects(this.Converter); } public async Task> GetNeuronIds() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_ids", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_ids", arg); return reply.ToObjects>(this.Converter); } public async Task GetNeuronInfo(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info", arg); return reply.ToObjects(this.Converter); } public async Task GetNeuronInfoByIdOrSubaccount(NeuronIdOrSubaccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info_by_id_or_subaccount", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info_by_id_or_subaccount", arg); return reply.ToObjects(this.Converter); } public async Task GetNodeProviderByCaller(NullValue arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_node_provider_by_caller", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_node_provider_by_caller", arg); return reply.ToObjects(this.Converter); } public async Task> GetPendingProposals() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_pending_proposals", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_pending_proposals", arg); return reply.ToObjects>(this.Converter); } public async Task> GetProposalInfo(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_proposal_info", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_proposal_info", arg); return reply.ToObjects>(this.Converter); } public async Task ListKnownNeurons() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_known_neurons", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_known_neurons", arg); return reply.ToObjects(this.Converter); } public async Task ListNeurons(ListNeurons arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_neurons", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_neurons", arg); return reply.ToObjects(this.Converter); } public async Task ListNodeProviders() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_node_providers", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_node_providers", arg); return reply.ToObjects(this.Converter); } public async Task ListProposals(ListProposalInfo arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_proposals", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_proposals", arg); return reply.ToObjects(this.Converter); } diff --git a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap index 8115c6c8..ce0d0da1 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap @@ -38,24 +38,21 @@ namespace Test public async Task GetBuildMetadata() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_build_metadata", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_build_metadata", arg); return reply.ToObjects(this.Converter); } public async Task GetFullNeuron(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron", arg); return reply.ToObjects(this.Converter); } public async Task GetFullNeuronByIdOrSubaccount(NeuronIdOrSubaccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron_by_id_or_subaccount", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron_by_id_or_subaccount", arg); return reply.ToObjects(this.Converter); } @@ -69,88 +66,77 @@ namespace Test public async Task GetNetworkEconomicsParameters() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_network_economics_parameters", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_network_economics_parameters", arg); return reply.ToObjects(this.Converter); } public async Task> GetNeuronIds() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_ids", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_ids", arg); return reply.ToObjects>(this.Converter); } public async Task GetNeuronInfo(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info", arg); return reply.ToObjects(this.Converter); } public async Task GetNeuronInfoByIdOrSubaccount(NeuronIdOrSubaccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info_by_id_or_subaccount", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info_by_id_or_subaccount", arg); return reply.ToObjects(this.Converter); } public async Task GetNodeProviderByCaller(NullValue arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_node_provider_by_caller", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_node_provider_by_caller", arg); return reply.ToObjects(this.Converter); } public async Task> GetPendingProposals() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_pending_proposals", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_pending_proposals", arg); return reply.ToObjects>(this.Converter); } public async Task> GetProposalInfo(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_proposal_info", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_proposal_info", arg); return reply.ToObjects>(this.Converter); } public async Task ListKnownNeurons() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_known_neurons", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_known_neurons", arg); return reply.ToObjects(this.Converter); } public async Task ListNeurons(ListNeurons arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_neurons", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_neurons", arg); return reply.ToObjects(this.Converter); } public async Task ListNodeProviders() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_node_providers", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_node_providers", arg); return reply.ToObjects(this.Converter); } public async Task ListProposals(ListProposalInfo arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_proposals", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_proposals", arg); return reply.ToObjects(this.Converter); } diff --git a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap index 38383a20..acc68ed9 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap @@ -38,24 +38,21 @@ namespace Test public async Task _get_build_metadata() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_build_metadata", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_build_metadata", arg); return reply.ToObjects(this.Converter); } public async Task _get_full_neuron(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron", arg); return reply.ToObjects(this.Converter); } public async Task _get_full_neuron_by_id_or_subaccount(NeuronIdOrSubaccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron_by_id_or_subaccount", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron_by_id_or_subaccount", arg); return reply.ToObjects(this.Converter); } @@ -69,88 +66,77 @@ namespace Test public async Task _get_network_economics_parameters() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_network_economics_parameters", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_network_economics_parameters", arg); return reply.ToObjects(this.Converter); } public async Task> _get_neuron_ids() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_ids", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_ids", arg); return reply.ToObjects>(this.Converter); } public async Task _get_neuron_info(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info", arg); return reply.ToObjects(this.Converter); } public async Task _get_neuron_info_by_id_or_subaccount(NeuronIdOrSubaccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info_by_id_or_subaccount", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info_by_id_or_subaccount", arg); return reply.ToObjects(this.Converter); } public async Task _get_node_provider_by_caller(NullValue arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_node_provider_by_caller", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_node_provider_by_caller", arg); return reply.ToObjects(this.Converter); } public async Task> _get_pending_proposals() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_pending_proposals", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_pending_proposals", arg); return reply.ToObjects>(this.Converter); } public async Task> _get_proposal_info(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_proposal_info", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_proposal_info", arg); return reply.ToObjects>(this.Converter); } public async Task list_known_neurons() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_known_neurons", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_known_neurons", arg); return reply.ToObjects(this.Converter); } public async Task list_neurons(ListNeurons arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_neurons", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_neurons", arg); return reply.ToObjects(this.Converter); } public async Task list_node_providers() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_node_providers", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_node_providers", arg); return reply.ToObjects(this.Converter); } public async Task list_proposals(ListProposalInfo arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_proposals", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_proposals", arg); return reply.ToObjects(this.Converter); } diff --git a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap index ee9b049d..a3f51f66 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap @@ -38,24 +38,21 @@ namespace Test public async Task _get_build_metadata() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_build_metadata", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_build_metadata", arg); return reply.ToObjects(this.Converter); } public async Task _get_full_neuron(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron", arg); return reply.ToObjects(this.Converter); } public async Task _get_full_neuron_by_id_or_subaccount(NeuronIdOrSubaccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron_by_id_or_subaccount", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron_by_id_or_subaccount", arg); return reply.ToObjects(this.Converter); } @@ -69,88 +66,77 @@ namespace Test public async Task _get_network_economics_parameters() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_network_economics_parameters", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_network_economics_parameters", arg); return reply.ToObjects(this.Converter); } public async Task> _get_neuron_ids() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_ids", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_ids", arg); return reply.ToObjects>(this.Converter); } public async Task _get_neuron_info(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info", arg); return reply.ToObjects(this.Converter); } public async Task _get_neuron_info_by_id_or_subaccount(NeuronIdOrSubaccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info_by_id_or_subaccount", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info_by_id_or_subaccount", arg); return reply.ToObjects(this.Converter); } public async Task _get_node_provider_by_caller(NullValue arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_node_provider_by_caller", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_node_provider_by_caller", arg); return reply.ToObjects(this.Converter); } public async Task> _get_pending_proposals() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_pending_proposals", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_pending_proposals", arg); return reply.ToObjects>(this.Converter); } public async Task> _get_proposal_info(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_proposal_info", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_proposal_info", arg); return reply.ToObjects>(this.Converter); } public async Task list_known_neurons() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_known_neurons", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_known_neurons", arg); return reply.ToObjects(this.Converter); } public async Task list_neurons(ListNeurons arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_neurons", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_neurons", arg); return reply.ToObjects(this.Converter); } public async Task list_node_providers() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_node_providers", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_node_providers", arg); return reply.ToObjects(this.Converter); } public async Task list_proposals(ListProposalInfo arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_proposals", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_proposals", arg); return reply.ToObjects(this.Converter); } diff --git a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap index 1644b72c..c5ca948e 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap @@ -38,24 +38,21 @@ namespace Test public async Task _get_build_metadata() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_build_metadata", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_build_metadata", arg); return reply.ToObjects(this.Converter); } public async Task _get_full_neuron(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron", arg); return reply.ToObjects(this.Converter); } public async Task _get_full_neuron_by_id_or_subaccount(NeuronIdOrSubaccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron_by_id_or_subaccount", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron_by_id_or_subaccount", arg); return reply.ToObjects(this.Converter); } @@ -69,88 +66,77 @@ namespace Test public async Task _get_network_economics_parameters() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_network_economics_parameters", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_network_economics_parameters", arg); return reply.ToObjects(this.Converter); } public async Task> _get_neuron_ids() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_ids", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_ids", arg); return reply.ToObjects>(this.Converter); } public async Task _get_neuron_info(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info", arg); return reply.ToObjects(this.Converter); } public async Task _get_neuron_info_by_id_or_subaccount(NeuronIdOrSubaccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info_by_id_or_subaccount", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info_by_id_or_subaccount", arg); return reply.ToObjects(this.Converter); } public async Task _get_node_provider_by_caller(NullValue arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_node_provider_by_caller", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_node_provider_by_caller", arg); return reply.ToObjects(this.Converter); } public async Task> _get_pending_proposals() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_pending_proposals", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_pending_proposals", arg); return reply.ToObjects>(this.Converter); } public async Task> _get_proposal_info(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_proposal_info", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_proposal_info", arg); return reply.ToObjects>(this.Converter); } public async Task list_known_neurons() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_known_neurons", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_known_neurons", arg); return reply.ToObjects(this.Converter); } public async Task list_neurons(ListNeurons arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_neurons", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_neurons", arg); return reply.ToObjects(this.Converter); } public async Task list_node_providers() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_node_providers", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_node_providers", arg); return reply.ToObjects(this.Converter); } public async Task list_proposals(ListProposalInfo arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_proposals", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_proposals", arg); return reply.ToObjects(this.Converter); } diff --git a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap index b7b2ba4b..4cee15fc 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap @@ -38,24 +38,21 @@ namespace Test public async Task _get_build_metadata() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_build_metadata", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_build_metadata", arg); return reply.ToObjects(this.Converter); } public async Task _get_full_neuron(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron", arg); return reply.ToObjects(this.Converter); } public async Task _get_full_neuron_by_id_or_subaccount(NeuronIdOrSubaccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron_by_id_or_subaccount", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron_by_id_or_subaccount", arg); return reply.ToObjects(this.Converter); } @@ -69,88 +66,77 @@ namespace Test public async Task _get_network_economics_parameters() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_network_economics_parameters", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_network_economics_parameters", arg); return reply.ToObjects(this.Converter); } public async Task> _get_neuron_ids() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_ids", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_ids", arg); return reply.ToObjects>(this.Converter); } public async Task _get_neuron_info(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info", arg); return reply.ToObjects(this.Converter); } public async Task _get_neuron_info_by_id_or_subaccount(NeuronIdOrSubaccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info_by_id_or_subaccount", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info_by_id_or_subaccount", arg); return reply.ToObjects(this.Converter); } public async Task _get_node_provider_by_caller(NullValue arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_node_provider_by_caller", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_node_provider_by_caller", arg); return reply.ToObjects(this.Converter); } public async Task> _get_pending_proposals() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_pending_proposals", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_pending_proposals", arg); return reply.ToObjects>(this.Converter); } public async Task> _get_proposal_info(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_proposal_info", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_proposal_info", arg); return reply.ToObjects>(this.Converter); } public async Task list_known_neurons() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_known_neurons", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_known_neurons", arg); return reply.ToObjects(this.Converter); } public async Task list_neurons(ListNeurons arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_neurons", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_neurons", arg); return reply.ToObjects(this.Converter); } public async Task list_node_providers() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_node_providers", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_node_providers", arg); return reply.ToObjects(this.Converter); } public async Task list_proposals(ListProposalInfo arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_proposals", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_proposals", arg); return reply.ToObjects(this.Converter); } diff --git a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap index cc054b5a..43faa356 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap @@ -38,24 +38,21 @@ namespace Test public async Task GetBuildMetadata() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_build_metadata", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_build_metadata", arg); return reply.ToObjects(this.Converter); } public async Task GetFullNeuron(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron", arg); return reply.ToObjects(this.Converter); } public async Task GetFullNeuronByIdOrSubaccount(NeuronIdOrSubaccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron_by_id_or_subaccount", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron_by_id_or_subaccount", arg); return reply.ToObjects(this.Converter); } @@ -69,88 +66,77 @@ namespace Test public async Task GetNetworkEconomicsParameters() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_network_economics_parameters", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_network_economics_parameters", arg); return reply.ToObjects(this.Converter); } public async Task> GetNeuronIds() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_ids", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_ids", arg); return reply.ToObjects>(this.Converter); } public async Task GetNeuronInfo(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info", arg); return reply.ToObjects(this.Converter); } public async Task GetNeuronInfoByIdOrSubaccount(NeuronIdOrSubaccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info_by_id_or_subaccount", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info_by_id_or_subaccount", arg); return reply.ToObjects(this.Converter); } public async Task GetNodeProviderByCaller(NullValue arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_node_provider_by_caller", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_node_provider_by_caller", arg); return reply.ToObjects(this.Converter); } public async Task> GetPendingProposals() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_pending_proposals", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_pending_proposals", arg); return reply.ToObjects>(this.Converter); } public async Task> GetProposalInfo(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_proposal_info", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_proposal_info", arg); return reply.ToObjects>(this.Converter); } public async Task ListKnownNeurons() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_known_neurons", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_known_neurons", arg); return reply.ToObjects(this.Converter); } public async Task ListNeurons(ListNeurons arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_neurons", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_neurons", arg); return reply.ToObjects(this.Converter); } public async Task ListNodeProviders() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_node_providers", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_node_providers", arg); return reply.ToObjects(this.Converter); } public async Task ListProposals(ListProposalInfo arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_proposals", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_proposals", arg); return reply.ToObjects(this.Converter); } diff --git a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap index 30b8476f..8b905f76 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap @@ -38,24 +38,21 @@ namespace Test public async Task GetBuildMetadata() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_build_metadata", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_build_metadata", arg); return reply.ToObjects(this.Converter); } public async Task GetFullNeuron(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron", arg); return reply.ToObjects(this.Converter); } public async Task GetFullNeuronByIdOrSubaccount(NeuronIdOrSubaccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron_by_id_or_subaccount", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron_by_id_or_subaccount", arg); return reply.ToObjects(this.Converter); } @@ -69,88 +66,77 @@ namespace Test public async Task GetNetworkEconomicsParameters() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_network_economics_parameters", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_network_economics_parameters", arg); return reply.ToObjects(this.Converter); } public async Task> GetNeuronIds() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_ids", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_ids", arg); return reply.ToObjects>(this.Converter); } public async Task GetNeuronInfo(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info", arg); return reply.ToObjects(this.Converter); } public async Task GetNeuronInfoByIdOrSubaccount(NeuronIdOrSubaccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info_by_id_or_subaccount", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info_by_id_or_subaccount", arg); return reply.ToObjects(this.Converter); } public async Task GetNodeProviderByCaller(NullValue arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_node_provider_by_caller", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_node_provider_by_caller", arg); return reply.ToObjects(this.Converter); } public async Task> GetPendingProposals() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_pending_proposals", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_pending_proposals", arg); return reply.ToObjects>(this.Converter); } public async Task> GetProposalInfo(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_proposal_info", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_proposal_info", arg); return reply.ToObjects>(this.Converter); } public async Task ListKnownNeurons() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_known_neurons", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_known_neurons", arg); return reply.ToObjects(this.Converter); } public async Task ListNeurons(ListNeurons arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_neurons", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_neurons", arg); return reply.ToObjects(this.Converter); } public async Task ListNodeProviders() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_node_providers", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_node_providers", arg); return reply.ToObjects(this.Converter); } public async Task ListProposals(ListProposalInfo arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_proposals", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_proposals", arg); return reply.ToObjects(this.Converter); } diff --git a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap index 9aaa0db2..2a7285b7 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap @@ -38,24 +38,21 @@ namespace Test public async Task GetBuildMetadata() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_build_metadata", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_build_metadata", arg); return reply.ToObjects(this.Converter); } public async Task GetFullNeuron(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron", arg); return reply.ToObjects(this.Converter); } public async Task GetFullNeuronByIdOrSubaccount(NeuronIdOrSubaccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron_by_id_or_subaccount", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron_by_id_or_subaccount", arg); return reply.ToObjects(this.Converter); } @@ -69,88 +66,77 @@ namespace Test public async Task GetNetworkEconomicsParameters() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_network_economics_parameters", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_network_economics_parameters", arg); return reply.ToObjects(this.Converter); } public async Task> GetNeuronIds() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_ids", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_ids", arg); return reply.ToObjects>(this.Converter); } public async Task GetNeuronInfo(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info", arg); return reply.ToObjects(this.Converter); } public async Task GetNeuronInfoByIdOrSubaccount(NeuronIdOrSubaccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info_by_id_or_subaccount", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info_by_id_or_subaccount", arg); return reply.ToObjects(this.Converter); } public async Task GetNodeProviderByCaller(NullValue arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_node_provider_by_caller", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_node_provider_by_caller", arg); return reply.ToObjects(this.Converter); } public async Task> GetPendingProposals() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_pending_proposals", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_pending_proposals", arg); return reply.ToObjects>(this.Converter); } public async Task> GetProposalInfo(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_proposal_info", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_proposal_info", arg); return reply.ToObjects>(this.Converter); } public async Task ListKnownNeurons() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_known_neurons", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_known_neurons", arg); return reply.ToObjects(this.Converter); } public async Task ListNeurons(ListNeurons arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_neurons", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_neurons", arg); return reply.ToObjects(this.Converter); } public async Task ListNodeProviders() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_node_providers", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_node_providers", arg); return reply.ToObjects(this.Converter); } public async Task ListProposals(ListProposalInfo arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_proposals", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_proposals", arg); return reply.ToObjects(this.Converter); } diff --git a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap index 675d2540..857cb822 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap @@ -38,24 +38,21 @@ namespace Test public async Task GetBuildMetadata() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_build_metadata", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_build_metadata", arg); return reply.ToObjects(this.Converter); } public async Task GetFullNeuron(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron", arg); return reply.ToObjects(this.Converter); } public async Task GetFullNeuronByIdOrSubaccount(NeuronIdOrSubaccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron_by_id_or_subaccount", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron_by_id_or_subaccount", arg); return reply.ToObjects(this.Converter); } @@ -69,88 +66,77 @@ namespace Test public async Task GetNetworkEconomicsParameters() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_network_economics_parameters", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_network_economics_parameters", arg); return reply.ToObjects(this.Converter); } public async Task> GetNeuronIds() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_ids", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_ids", arg); return reply.ToObjects>(this.Converter); } public async Task GetNeuronInfo(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info", arg); return reply.ToObjects(this.Converter); } public async Task GetNeuronInfoByIdOrSubaccount(NeuronIdOrSubaccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info_by_id_or_subaccount", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info_by_id_or_subaccount", arg); return reply.ToObjects(this.Converter); } public async Task GetNodeProviderByCaller(NullValue arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_node_provider_by_caller", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_node_provider_by_caller", arg); return reply.ToObjects(this.Converter); } public async Task> GetPendingProposals() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_pending_proposals", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_pending_proposals", arg); return reply.ToObjects>(this.Converter); } public async Task> GetProposalInfo(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_proposal_info", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_proposal_info", arg); return reply.ToObjects>(this.Converter); } public async Task ListKnownNeurons() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_known_neurons", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_known_neurons", arg); return reply.ToObjects(this.Converter); } public async Task ListNeurons(ListNeurons arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_neurons", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_neurons", arg); return reply.ToObjects(this.Converter); } public async Task ListNodeProviders() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_node_providers", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_node_providers", arg); return reply.ToObjects(this.Converter); } public async Task ListProposals(ListProposalInfo arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_proposals", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_proposals", arg); return reply.ToObjects(this.Converter); } diff --git a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap index c09b134f..336fa7e8 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap @@ -38,24 +38,21 @@ namespace Test public async Task _get_build_metadata() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_build_metadata", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_build_metadata", arg); return reply.ToObjects(this.Converter); } public async Task _get_full_neuron(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron", arg); return reply.ToObjects(this.Converter); } public async Task _get_full_neuron_by_id_or_subaccount(NeuronIdOrSubaccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron_by_id_or_subaccount", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron_by_id_or_subaccount", arg); return reply.ToObjects(this.Converter); } @@ -69,88 +66,77 @@ namespace Test public async Task _get_network_economics_parameters() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_network_economics_parameters", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_network_economics_parameters", arg); return reply.ToObjects(this.Converter); } public async Task> _get_neuron_ids() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_ids", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_ids", arg); return reply.ToObjects>(this.Converter); } public async Task _get_neuron_info(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info", arg); return reply.ToObjects(this.Converter); } public async Task _get_neuron_info_by_id_or_subaccount(NeuronIdOrSubaccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info_by_id_or_subaccount", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info_by_id_or_subaccount", arg); return reply.ToObjects(this.Converter); } public async Task _get_node_provider_by_caller(NullValue arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_node_provider_by_caller", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_node_provider_by_caller", arg); return reply.ToObjects(this.Converter); } public async Task> _get_pending_proposals() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_pending_proposals", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_pending_proposals", arg); return reply.ToObjects>(this.Converter); } public async Task> _get_proposal_info(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_proposal_info", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_proposal_info", arg); return reply.ToObjects>(this.Converter); } public async Task list_known_neurons() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_known_neurons", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_known_neurons", arg); return reply.ToObjects(this.Converter); } public async Task list_neurons(ListNeurons arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_neurons", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_neurons", arg); return reply.ToObjects(this.Converter); } public async Task list_node_providers() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_node_providers", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_node_providers", arg); return reply.ToObjects(this.Converter); } public async Task list_proposals(ListProposalInfo arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_proposals", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_proposals", arg); return reply.ToObjects(this.Converter); } diff --git a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap index ff9c9886..2dcec56c 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap @@ -38,24 +38,21 @@ namespace Test public async Task _get_build_metadata() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_build_metadata", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_build_metadata", arg); return reply.ToObjects(this.Converter); } public async Task _get_full_neuron(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron", arg); return reply.ToObjects(this.Converter); } public async Task _get_full_neuron_by_id_or_subaccount(NeuronIdOrSubaccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron_by_id_or_subaccount", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron_by_id_or_subaccount", arg); return reply.ToObjects(this.Converter); } @@ -69,88 +66,77 @@ namespace Test public async Task _get_network_economics_parameters() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_network_economics_parameters", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_network_economics_parameters", arg); return reply.ToObjects(this.Converter); } public async Task> _get_neuron_ids() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_ids", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_ids", arg); return reply.ToObjects>(this.Converter); } public async Task _get_neuron_info(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info", arg); return reply.ToObjects(this.Converter); } public async Task _get_neuron_info_by_id_or_subaccount(NeuronIdOrSubaccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info_by_id_or_subaccount", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info_by_id_or_subaccount", arg); return reply.ToObjects(this.Converter); } public async Task _get_node_provider_by_caller(NullValue arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_node_provider_by_caller", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_node_provider_by_caller", arg); return reply.ToObjects(this.Converter); } public async Task> _get_pending_proposals() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_pending_proposals", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_pending_proposals", arg); return reply.ToObjects>(this.Converter); } public async Task> _get_proposal_info(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_proposal_info", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_proposal_info", arg); return reply.ToObjects>(this.Converter); } public async Task list_known_neurons() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_known_neurons", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_known_neurons", arg); return reply.ToObjects(this.Converter); } public async Task list_neurons(ListNeurons arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_neurons", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_neurons", arg); return reply.ToObjects(this.Converter); } public async Task list_node_providers() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_node_providers", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_node_providers", arg); return reply.ToObjects(this.Converter); } public async Task list_proposals(ListProposalInfo arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_proposals", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_proposals", arg); return reply.ToObjects(this.Converter); } diff --git a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap index d74e682e..fda4648f 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap @@ -38,24 +38,21 @@ namespace Test public async Task _get_build_metadata() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_build_metadata", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_build_metadata", arg); return reply.ToObjects(this.Converter); } public async Task _get_full_neuron(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron", arg); return reply.ToObjects(this.Converter); } public async Task _get_full_neuron_by_id_or_subaccount(NeuronIdOrSubaccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron_by_id_or_subaccount", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron_by_id_or_subaccount", arg); return reply.ToObjects(this.Converter); } @@ -69,88 +66,77 @@ namespace Test public async Task _get_network_economics_parameters() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_network_economics_parameters", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_network_economics_parameters", arg); return reply.ToObjects(this.Converter); } public async Task> _get_neuron_ids() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_ids", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_ids", arg); return reply.ToObjects>(this.Converter); } public async Task _get_neuron_info(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info", arg); return reply.ToObjects(this.Converter); } public async Task _get_neuron_info_by_id_or_subaccount(NeuronIdOrSubaccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info_by_id_or_subaccount", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info_by_id_or_subaccount", arg); return reply.ToObjects(this.Converter); } public async Task _get_node_provider_by_caller(NullValue arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_node_provider_by_caller", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_node_provider_by_caller", arg); return reply.ToObjects(this.Converter); } public async Task> _get_pending_proposals() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_pending_proposals", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_pending_proposals", arg); return reply.ToObjects>(this.Converter); } public async Task> _get_proposal_info(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_proposal_info", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_proposal_info", arg); return reply.ToObjects>(this.Converter); } public async Task list_known_neurons() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_known_neurons", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_known_neurons", arg); return reply.ToObjects(this.Converter); } public async Task list_neurons(ListNeurons arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_neurons", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_neurons", arg); return reply.ToObjects(this.Converter); } public async Task list_node_providers() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_node_providers", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_node_providers", arg); return reply.ToObjects(this.Converter); } public async Task list_proposals(ListProposalInfo arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_proposals", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_proposals", arg); return reply.ToObjects(this.Converter); } diff --git a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap index 75a0eaef..06e8d423 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap @@ -38,24 +38,21 @@ namespace Test public async Task _get_build_metadata() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_build_metadata", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_build_metadata", arg); return reply.ToObjects(this.Converter); } public async Task _get_full_neuron(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron", arg); return reply.ToObjects(this.Converter); } public async Task _get_full_neuron_by_id_or_subaccount(NeuronIdOrSubaccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron_by_id_or_subaccount", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron_by_id_or_subaccount", arg); return reply.ToObjects(this.Converter); } @@ -69,88 +66,77 @@ namespace Test public async Task _get_network_economics_parameters() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_network_economics_parameters", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_network_economics_parameters", arg); return reply.ToObjects(this.Converter); } public async Task> _get_neuron_ids() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_ids", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_ids", arg); return reply.ToObjects>(this.Converter); } public async Task _get_neuron_info(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info", arg); return reply.ToObjects(this.Converter); } public async Task _get_neuron_info_by_id_or_subaccount(NeuronIdOrSubaccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info_by_id_or_subaccount", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info_by_id_or_subaccount", arg); return reply.ToObjects(this.Converter); } public async Task _get_node_provider_by_caller(NullValue arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_node_provider_by_caller", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_node_provider_by_caller", arg); return reply.ToObjects(this.Converter); } public async Task> _get_pending_proposals() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_pending_proposals", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_pending_proposals", arg); return reply.ToObjects>(this.Converter); } public async Task> _get_proposal_info(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_proposal_info", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_proposal_info", arg); return reply.ToObjects>(this.Converter); } public async Task list_known_neurons() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_known_neurons", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_known_neurons", arg); return reply.ToObjects(this.Converter); } public async Task list_neurons(ListNeurons arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_neurons", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_neurons", arg); return reply.ToObjects(this.Converter); } public async Task list_node_providers() { CandidArg arg = CandidArg.FromCandid(); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_node_providers", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_node_providers", arg); return reply.ToObjects(this.Converter); } public async Task list_proposals(ListProposalInfo arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_proposals", arg); - CandidArg reply = response.ThrowOrGetReply(); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_proposals", arg); return reply.ToObjects(this.Converter); } diff --git a/test/Candid.Tests/SigningTests.cs b/test/Candid.Tests/SigningTests.cs index ea24f32a..2eb387c9 100644 --- a/test/Candid.Tests/SigningTests.cs +++ b/test/Candid.Tests/SigningTests.cs @@ -41,13 +41,12 @@ public void Sign_QueryRequest() }; var chainPublicKey = SubjectPublicKeyInfo.Ed25519(ByteUtil.FromHexString("303c300c060a2b0601040183b8430102032c000a00000000000000070101a451d1829b843e2aabdd49ea590668978a73612067bdde0b8502f844452a7558")); var chain = new DelegationChain(chainPublicKey, delegations); - var identity = new DelegationIdentity(innerIdentity, chain); + IIdentity identity = new DelegationIdentity(innerIdentity, chain); var sender = identity.GetPublicKey().ToPrincipal(); var ingressExpiry = ICTimestamp.FromNanoSeconds(1654598046354206365); var request = new QueryRequest(canisterId, method, arg, sender, ingressExpiry); - Dictionary content = request.BuildHashableItem(); - SignedContent signedContent = identity.SignContent(content); + SignedContent signedContent = identity.SignContent(request); string signatureHex = ByteUtil.ToHexString(signedContent.SenderSignature!); Snapshot.Match(signatureHex); diff --git a/test/Performance.Tests/Benchmarks/SignatureBenchmarks.cs b/test/Performance.Tests/Benchmarks/SignatureBenchmarks.cs index e90220d9..a40d838b 100644 --- a/test/Performance.Tests/Benchmarks/SignatureBenchmarks.cs +++ b/test/Performance.Tests/Benchmarks/SignatureBenchmarks.cs @@ -13,14 +13,12 @@ namespace Performance.Tests.Benchmarks { public class SignatureBenchmarks { - private readonly DefaultBlsCryptograhy bls; private readonly byte[] publicKey; private readonly byte[] msgHash; private readonly byte[] signature; public SignatureBenchmarks() { - this.bls = new DefaultBlsCryptograhy(); //this.publicKey = ByteUtil.FromHexString("a7623a93cdb56c4d23d99c14216afaab3dfd6d4f9eb3db23d038280b6d5cb2caaee2a19dd92c9df7001dede23bf036bc0f33982dfb41e8fa9b8e96b5dc3e83d55ca4dd146c7eb2e8b6859cb5a5db815db86810b8d12cee1588b5dbf34a4dc9a5"); //this.msgHash = ByteUtil.FromHexString("hello"); //this.signature = ByteUtil.FromHexString("b89e13a212c830586eaa9ad53946cd968718ebecc27eda849d9232673dcd4f440e8b5df39bf14a88048c15e16cbcaabe"); @@ -32,7 +30,7 @@ public SignatureBenchmarks() [Benchmark] public void Verify() { - this.bls.VerifySignature(this.publicKey, this.msgHash, this.signature); + DefaultBlsCryptograhy.VerifySignature(this.publicKey, this.msgHash, this.signature); } } diff --git a/test/PocketIC.Tests/PocketIc.Tests.cs b/test/PocketIC.Tests/PocketIc.Tests.cs index f7388b01..9310df68 100644 --- a/test/PocketIC.Tests/PocketIc.Tests.cs +++ b/test/PocketIC.Tests/PocketIc.Tests.cs @@ -176,8 +176,7 @@ await pocketIc.UpdateCallNoResponseAsync( await using (HttpGateway httpGateway = await pocketIc.RunHttpGatewayAsync()) { HttpAgent agent = httpGateway.BuildHttpAgent(); - QueryResponse getResponse = await agent.QueryAsync(canisterId, "get", CandidArg.Empty()); - CandidArg getResponseArg = getResponse.ThrowOrGetReply(); + CandidArg getResponseArg = await agent.QueryAsync(canisterId, "get", CandidArg.Empty()); UnboundedUInt getResponseValue = getResponseArg.ToObjects(); Assert.Equal((UnboundedUInt)2, getResponseValue); @@ -185,8 +184,7 @@ await pocketIc.UpdateCallNoResponseAsync( CandidArg incResponseArg = await agent.CallAsync(canisterId, "inc", CandidArg.Empty(), cancellationToken: cts.Token); Assert.Equal(CandidArg.Empty(), incResponseArg); - getResponse = await agent.QueryAsync(canisterId, "get", CandidArg.Empty()); - getResponseArg = getResponse.ThrowOrGetReply(); + getResponseArg = await agent.QueryAsync(canisterId, "get", CandidArg.Empty()); getResponseValue = getResponseArg.ToObjects(); Assert.Equal((UnboundedUInt)3, getResponseValue); diff --git a/test/WebSockets.Tests/WebSocketsAgentTests.cs b/test/WebSockets.Tests/WebSocketsAgentTests.cs index df477c94..4fd790d1 100644 --- a/test/WebSockets.Tests/WebSocketsAgentTests.cs +++ b/test/WebSockets.Tests/WebSocketsAgentTests.cs @@ -140,10 +140,6 @@ public async Task ValidCallAndClose() clientMock .SetupGet(client => client.IsOpen) .Returns(() => onCloseCallCount <= 0); - var blsMock = new Mock(MockBehavior.Strict); - blsMock - .Setup(bls => bls.VerifySignature(It.IsAny(), It.IsAny(), It.IsAny())) - .Returns(true); Action onMessage = (TestMessage message) => { @@ -162,7 +158,6 @@ public async Task ValidCallAndClose() rootPublicKey, identity, clientMock.Object, - blsMock.Object, onMessage, onOpen, onError, @@ -282,10 +277,6 @@ public async Task InvalidAck_Close() clientMock .SetupGet(client => client.IsOpen) .Returns(() => onCloseCallCount <= 0 && onErrorCallCount <= 0); - var blsMock = new Mock(MockBehavior.Strict); - blsMock - .Setup(bls => bls.VerifySignature(It.IsAny(), It.IsAny(), It.IsAny())) - .Returns(true); Action onMessage = (TestMessage message) => { @@ -305,7 +296,6 @@ public async Task InvalidAck_Close() rootPublicKey, identity, clientMock.Object, - blsMock.Object, onMessage, onOpen, onError, From e02fbb82e2deee290ec7ff9b7ada415de5a3cffa Mon Sep 17 00:00:00 2001 From: Gekctek Date: Wed, 5 Mar 2025 21:37:57 -0800 Subject: [PATCH 03/20] Updating packages --- .../Sample.PocketIC/Sample.PocketIC.csproj | 10 +-- .../Governance/GovernanceApiClient.cs | 64 ++++++++++--------- .../Sample.WebSockets.csproj | 2 +- src/Agent/API.xml | 26 ++++++-- src/Agent/EdjCase.ICP.Agent.csproj | 4 +- src/Candid/EdjCase.ICP.Candid.csproj | 6 +- .../EdjCase.ICP.ClientGenerator.csproj | 6 +- test/BLS.Tests/BLS.Tests.csproj | 8 +-- test/Candid.Tests/Candid.Tests.csproj | 12 ++-- .../Performance.Tests.csproj | 2 +- test/PocketIC.Tests/PocketIC.Tests.csproj | 10 +-- test/WebSockets.Tests/WebSockets.Tests.csproj | 8 +-- 12 files changed, 88 insertions(+), 70 deletions(-) diff --git a/samples/Sample.PocketIC/Sample.PocketIC.csproj b/samples/Sample.PocketIC/Sample.PocketIC.csproj index 048314ff..0cac97ab 100644 --- a/samples/Sample.PocketIC/Sample.PocketIC.csproj +++ b/samples/Sample.PocketIC/Sample.PocketIC.csproj @@ -10,17 +10,17 @@ - - - + + + runtime; build; native; contentfiles; analyzers; buildtransitive all - + runtime; build; native; contentfiles; analyzers; buildtransitive all - + diff --git a/samples/Sample.Shared/Governance/GovernanceApiClient.cs b/samples/Sample.Shared/Governance/GovernanceApiClient.cs index e6664433..c8bc9b8d 100644 --- a/samples/Sample.Shared/Governance/GovernanceApiClient.cs +++ b/samples/Sample.Shared/Governance/GovernanceApiClient.cs @@ -2,23 +2,29 @@ using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; -using Sample.Shared.Governance; using System.Collections.Generic; -using EdjCase.ICP.Agent.Responses; +using EdjCase.ICP.Agent.Identities; namespace Sample.Shared.Governance { public class GovernanceApiClient { + public IIdentity? Identity { get; set; } public IAgent Agent { get; } public Principal CanisterId { get; } public CandidConverter? Converter { get; } - public GovernanceApiClient(IAgent agent, Principal canisterId, CandidConverter? converter = default) + public GovernanceApiClient( + IAgent agent, + Principal canisterId, + IIdentity? identity = null, + CandidConverter? converter = default + ) { this.Agent = agent; + this.Identity = identity; this.CanisterId = canisterId; this.Converter = converter; } @@ -26,176 +32,176 @@ public GovernanceApiClient(IAgent agent, Principal canisterId, CandidConverter? public async Task ClaimGtcNeurons(Principal arg0, List arg1) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "claim_gtc_neurons", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "claim_gtc_neurons", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task ClaimOrRefreshNeuronFromAccount(Models.ClaimOrRefreshNeuronFromAccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "claim_or_refresh_neuron_from_account", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "claim_or_refresh_neuron_from_account", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task GetBuildMetadata() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_build_metadata", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_build_metadata", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task GetFullNeuron(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task GetFullNeuronByIdOrSubaccount(Models.NeuronIdOrSubaccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron_by_id_or_subaccount", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron_by_id_or_subaccount", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task GetLatestRewardEvent() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_latest_reward_event", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_latest_reward_event", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task GetMetrics() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_metrics", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_metrics", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task GetMonthlyNodeProviderRewards() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "get_monthly_node_provider_rewards", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "get_monthly_node_provider_rewards", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task> GetMostRecentMonthlyNodeProviderRewards() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_most_recent_monthly_node_provider_rewards", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_most_recent_monthly_node_provider_rewards", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task GetNetworkEconomicsParameters() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_network_economics_parameters", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_network_economics_parameters", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task> GetNeuronIds() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_ids", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_ids", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task GetNeuronInfo(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task GetNeuronInfoByIdOrSubaccount(Models.NeuronIdOrSubaccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info_by_id_or_subaccount", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info_by_id_or_subaccount", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task GetNodeProviderByCaller(NullValue arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_node_provider_by_caller", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_node_provider_by_caller", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task> GetPendingProposals() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_pending_proposals", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_pending_proposals", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task> GetProposalInfo(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_proposal_info", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_proposal_info", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task ListKnownNeurons() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_known_neurons", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_known_neurons", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task ListNeurons(Models.ListNeurons arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_neurons", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_neurons", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task ListNodeProviders() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_node_providers", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_node_providers", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task ListProposals(Models.ListProposalInfo arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_proposals", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_proposals", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task ManageNeuron(Models.ManageNeuron arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "manage_neuron", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "manage_neuron", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task SettleCommunityFundParticipation(Models.SettleCommunityFundParticipation arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "settle_community_fund_participation", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "settle_community_fund_participation", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task SimulateManageNeuron(Models.ManageNeuron arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "simulate_manage_neuron", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "simulate_manage_neuron", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task TransferGtcNeuron(Models.NeuronId arg0, Models.NeuronId arg1) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "transfer_gtc_neuron", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "transfer_gtc_neuron", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task UpdateNodeProvider(Models.UpdateNodeProvider arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "update_node_provider", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "update_node_provider", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } } -} \ No newline at end of file +} diff --git a/samples/Sample.WebSockets/Sample.WebSockets.csproj b/samples/Sample.WebSockets/Sample.WebSockets.csproj index 42fa78ab..5e18990c 100644 --- a/samples/Sample.WebSockets/Sample.WebSockets.csproj +++ b/samples/Sample.WebSockets/Sample.WebSockets.csproj @@ -8,7 +8,7 @@ - + diff --git a/src/Agent/API.xml b/src/Agent/API.xml index 2b87c593..4bf17d49 100644 --- a/src/Agent/API.xml +++ b/src/Agent/API.xml @@ -121,22 +121,29 @@ Optional. Token to cancel request The root public key bytes - + + + Extension methods for the `IAgent` interface + + + Gets the state of a specified canister with the subset of state information specified by the paths parameter + The agent to use for the call Canister to read state for The state paths to get information for. Other state data will be pruned if not specified Optional. Identity to sign the request with Optional. Token to cancel request A response that contains the certificate of the current canister state - + Sends a call request to a specified canister method and gets the response candid arg back using /v3/../call and falls back to /v2/../call if the v3 is not available + The agent to use for the call Canister to read state for The name of the method to call on the canister The candid arg to send with the request @@ -146,10 +153,11 @@ Optional. Token to cancel request The id of the request that can be used to look up its status with `GetRequestStatusAsync` - + Sends a query request to a specified canister method + The agent to use for the call Canister to read state for The name of the method to call on the canister The candid arg to send with the request @@ -159,12 +167,13 @@ Optional. Token to cancel request The response data of the query call - + Sends a call request to a specified canister method and gets back an id of the request that is being processed using /v2/../call. This call does NOT wait for the request to be complete. Either check the status with `GetRequestStatusAsync` or use the `CallV2AndWaitAsync` method + The agent to use for the call Canister to read state for The name of the method to call on the canister The candid arg to send with the request @@ -174,12 +183,13 @@ Optional. Token to cancel request The id of the request that can be used to look up its status with `GetRequestStatusAsync` - + Sends a call request to a specified canister method, waits for the request to be processed, the returns the candid response to the call. This is helper method built on top of `CallAsynchronousAsync` to wait for the response so it doesn't need to be implemented manually + The agent to use for the call Canister to read state for The name of the method to call on the canister The candid arg to send with the request @@ -189,22 +199,24 @@ Optional. Token to cancel request The raw candid arg response - + Gets the status of a request that is being processed by the specified canister + The agent to use for the call Canister where the request was sent to Id of the request to get a status for Optional. Identity to sign the request with Optional. Token to cancel request A status variant of the request. If request is not found, will return null - + Waits for a request to be processed and returns the candid response to the call. This is a helper method built on top of `GetRequestStatusAsync` to wait for the response so it doesn't need to be implemented manually + The agent to use for the call Canister to read state for The unique identifier for the request Optional. Token to cancel request diff --git a/src/Agent/EdjCase.ICP.Agent.csproj b/src/Agent/EdjCase.ICP.Agent.csproj index 3726df0c..ad83d0db 100644 --- a/src/Agent/EdjCase.ICP.Agent.csproj +++ b/src/Agent/EdjCase.ICP.Agent.csproj @@ -27,8 +27,8 @@ - - + + diff --git a/src/Candid/EdjCase.ICP.Candid.csproj b/src/Candid/EdjCase.ICP.Candid.csproj index b6baba3a..18a76852 100644 --- a/src/Candid/EdjCase.ICP.Candid.csproj +++ b/src/Candid/EdjCase.ICP.Candid.csproj @@ -26,9 +26,9 @@ - - - + + + diff --git a/src/ClientGenerator/EdjCase.ICP.ClientGenerator.csproj b/src/ClientGenerator/EdjCase.ICP.ClientGenerator.csproj index 593919f1..a9ae3073 100644 --- a/src/ClientGenerator/EdjCase.ICP.ClientGenerator.csproj +++ b/src/ClientGenerator/EdjCase.ICP.ClientGenerator.csproj @@ -32,9 +32,9 @@ - - - + + + diff --git a/test/BLS.Tests/BLS.Tests.csproj b/test/BLS.Tests/BLS.Tests.csproj index d9a4f958..3b06a556 100644 --- a/test/BLS.Tests/BLS.Tests.csproj +++ b/test/BLS.Tests/BLS.Tests.csproj @@ -11,13 +11,13 @@ - - - + + + runtime; build; native; contentfiles; analyzers; buildtransitive all - + runtime; build; native; contentfiles; analyzers; buildtransitive all diff --git a/test/Candid.Tests/Candid.Tests.csproj b/test/Candid.Tests/Candid.Tests.csproj index 5f0e6523..0705d088 100644 --- a/test/Candid.Tests/Candid.Tests.csproj +++ b/test/Candid.Tests/Candid.Tests.csproj @@ -19,19 +19,19 @@ - + - - - + + + runtime; build; native; contentfiles; analyzers; buildtransitive all - + runtime; build; native; contentfiles; analyzers; buildtransitive all - + diff --git a/test/Performance.Tests/Performance.Tests.csproj b/test/Performance.Tests/Performance.Tests.csproj index cd83f094..11dd71f8 100644 --- a/test/Performance.Tests/Performance.Tests.csproj +++ b/test/Performance.Tests/Performance.Tests.csproj @@ -9,7 +9,7 @@ - + diff --git a/test/PocketIC.Tests/PocketIC.Tests.csproj b/test/PocketIC.Tests/PocketIC.Tests.csproj index fd5a5383..d2c9b619 100644 --- a/test/PocketIC.Tests/PocketIC.Tests.csproj +++ b/test/PocketIC.Tests/PocketIC.Tests.csproj @@ -11,17 +11,17 @@ - - - + + + runtime; build; native; contentfiles; analyzers; buildtransitive all - + runtime; build; native; contentfiles; analyzers; buildtransitive all - + diff --git a/test/WebSockets.Tests/WebSockets.Tests.csproj b/test/WebSockets.Tests/WebSockets.Tests.csproj index bb6769e7..ceaf2ce2 100644 --- a/test/WebSockets.Tests/WebSockets.Tests.csproj +++ b/test/WebSockets.Tests/WebSockets.Tests.csproj @@ -10,13 +10,13 @@ - - - + + + runtime; build; native; contentfiles; analyzers; buildtransitive all - + runtime; build; native; contentfiles; analyzers; buildtransitive all From 905e3c7238fdbf535e0ec4a49afc3d019c7f50a7 Mon Sep 17 00:00:00 2001 From: Gekctek Date: Wed, 5 Mar 2025 21:50:10 -0800 Subject: [PATCH 04/20] Bypass Bls --- src/Agent/Requests/QueryRequest.cs | 2 +- src/BLS/DefaultBlsCryptograhy.cs | 8 ++++++++ src/BLS/Properties/AssemblyInfo.cs | 2 ++ test/PocketIC.Tests/PocketIc.Tests.cs | 2 ++ test/PocketIC.Tests/PocketIcServerFixture.cs | 5 ++++- test/WebSockets.Tests/WebSocketsAgentTests.cs | 5 +++++ 6 files changed, 22 insertions(+), 2 deletions(-) diff --git a/src/Agent/Requests/QueryRequest.cs b/src/Agent/Requests/QueryRequest.cs index eccc18ce..da665f05 100644 --- a/src/Agent/Requests/QueryRequest.cs +++ b/src/Agent/Requests/QueryRequest.cs @@ -65,7 +65,7 @@ public QueryRequest( this.Arg = arg ?? throw new ArgumentNullException(nameof(arg)); this.Sender = sender ?? throw new ArgumentNullException(nameof(sender)); this.IngressExpiry = ingressExpiry ?? throw new ArgumentNullException(nameof(ingressExpiry)); - this.Nonce = nonce ?? throw new ArgumentNullException(nameof(nonce)); + this.Nonce = nonce; } /// diff --git a/src/BLS/DefaultBlsCryptograhy.cs b/src/BLS/DefaultBlsCryptograhy.cs index 873a2446..c6f092d1 100644 --- a/src/BLS/DefaultBlsCryptograhy.cs +++ b/src/BLS/DefaultBlsCryptograhy.cs @@ -14,6 +14,8 @@ namespace EdjCase.ICP.BLS /// internal static class DefaultBlsCryptograhy { + public static bool Bypass = false; // TODO this isn't safe for multi-threaded use like with tests + internal static readonly byte[] DomainSeperator; static DefaultBlsCryptograhy() @@ -24,6 +26,12 @@ static DefaultBlsCryptograhy() /// public static bool VerifySignature(byte[] publicKey, byte[] messageHash, byte[] signature) { + if (DefaultBlsCryptograhy.Bypass) + { + // Always return true if bypass is enabled + // Used for testing and debugging + return true; + } G1Affine sig = G1Affine.FromCompressed(signature); G2Prepared g2Gen = G2Affine.Generator().Neg().ToProjective().ToPrepared(); diff --git a/src/BLS/Properties/AssemblyInfo.cs b/src/BLS/Properties/AssemblyInfo.cs index d25d2a15..5772320e 100644 --- a/src/BLS/Properties/AssemblyInfo.cs +++ b/src/BLS/Properties/AssemblyInfo.cs @@ -2,5 +2,7 @@ [assembly: InternalsVisibleTo("BLS.Tests")] [assembly: InternalsVisibleTo("Performance.Tests")] +[assembly: InternalsVisibleTo("PocketIC.Tests")] +[assembly: InternalsVisibleTo("WebSockets.Tests")] [assembly: InternalsVisibleTo("Sample.CLI")] [assembly: InternalsVisibleTo("EdjCase.ICP.Agent")] diff --git a/test/PocketIC.Tests/PocketIc.Tests.cs b/test/PocketIC.Tests/PocketIc.Tests.cs index 9310df68..d9a0aae5 100644 --- a/test/PocketIC.Tests/PocketIc.Tests.cs +++ b/test/PocketIC.Tests/PocketIc.Tests.cs @@ -6,6 +6,7 @@ using System.Threading.Tasks; using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Agent.Responses; +using EdjCase.ICP.BLS; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.PocketIC.Client; using EdjCase.ICP.PocketIC.Models; @@ -24,6 +25,7 @@ public PocketIcTests(PocketIcServerFixture fixture) this.fixture = fixture; } + [Fact] public async Task Test() { diff --git a/test/PocketIC.Tests/PocketIcServerFixture.cs b/test/PocketIC.Tests/PocketIcServerFixture.cs index 0da4e4ca..93763c0c 100644 --- a/test/PocketIC.Tests/PocketIcServerFixture.cs +++ b/test/PocketIC.Tests/PocketIcServerFixture.cs @@ -1,5 +1,6 @@ +using EdjCase.ICP.BLS; using System; namespace EdjCase.ICP.PocketIC.Tests; @@ -12,10 +13,12 @@ public PocketIcServerFixture() { // Start the server for all tests this.Server = PocketIcServer.StartAsync(runtimeLogLevel: LogLevel.Debug, showErrorLogs: true).GetAwaiter().GetResult(); + DefaultBlsCryptograhy.Bypass = true; } public void Dispose() { + DefaultBlsCryptograhy.Bypass = false; // Stop the server after all tests if (this.Server != null) { @@ -23,4 +26,4 @@ public void Dispose() this.Server.DisposeAsync().GetAwaiter().GetResult(); } } -} \ No newline at end of file +} diff --git a/test/WebSockets.Tests/WebSocketsAgentTests.cs b/test/WebSockets.Tests/WebSocketsAgentTests.cs index 4fd790d1..2d1c54f8 100644 --- a/test/WebSockets.Tests/WebSocketsAgentTests.cs +++ b/test/WebSockets.Tests/WebSocketsAgentTests.cs @@ -29,6 +29,7 @@ private class TestMessage [Fact] public async Task ValidCallAndClose() { + DefaultBlsCryptograhy.Bypass = true; int onMessageCallCount = 0; int onOpenCallCount = 0; int onErrorCallCount = 0; @@ -174,11 +175,13 @@ public async Task ValidCallAndClose() Assert.Equal(1, onMessageCallCount); Assert.Equal(0, onErrorCallCount); Assert.Equal(1, onCloseCallCount); + DefaultBlsCryptograhy.Bypass = false; } [Fact] public async Task InvalidAck_Close() { + DefaultBlsCryptograhy.Bypass = true; int onMessageCallCount = 0; int onOpenCallCount = 0; int onErrorCallCount = 0; @@ -312,6 +315,8 @@ public async Task InvalidAck_Close() Assert.Equal(1, onMessageCallCount); Assert.Equal(1, onErrorCallCount); Assert.Equal(0, onCloseCallCount); + + DefaultBlsCryptograhy.Bypass = false; } From 1e892a6d424485489eca8fad71fa0112e836409e Mon Sep 17 00:00:00 2001 From: Gekctek Date: Wed, 5 Mar 2025 22:07:34 -0800 Subject: [PATCH 05/20] Fixing tests --- src/ClientGenerator/RoslynTypeResolver.cs | 3832 ++++++++--------- ...ies_False_OverrideOptionalValue_False.snap | 3 +- ...ties_False_OverrideOptionalValue_True.snap | 3 +- ...ties_True_OverrideOptionalValue_False.snap | 3 +- ...rties_True_OverrideOptionalValue_True.snap | 3 +- ...ies_False_OverrideOptionalValue_False.snap | 3 +- ...ties_False_OverrideOptionalValue_True.snap | 3 +- ...ties_True_OverrideOptionalValue_False.snap | 3 +- ...rties_True_OverrideOptionalValue_True.snap | 3 +- ...ies_False_OverrideOptionalValue_False.snap | 3 +- ...ties_False_OverrideOptionalValue_True.snap | 3 +- ...ties_True_OverrideOptionalValue_False.snap | 3 +- ...rties_True_OverrideOptionalValue_True.snap | 3 +- ...ies_False_OverrideOptionalValue_False.snap | 3 +- ...ties_False_OverrideOptionalValue_True.snap | 3 +- ...ties_True_OverrideOptionalValue_False.snap | 3 +- ...rties_True_OverrideOptionalValue_True.snap | 3 +- ...ies_False_OverrideOptionalValue_False.snap | 3 +- ...ties_False_OverrideOptionalValue_True.snap | 3 +- ...ties_True_OverrideOptionalValue_False.snap | 3 +- ...rties_True_OverrideOptionalValue_True.snap | 3 +- ...ies_False_OverrideOptionalValue_False.snap | 3 +- ...ties_False_OverrideOptionalValue_True.snap | 3 +- ...ties_True_OverrideOptionalValue_False.snap | 3 +- ...rties_True_OverrideOptionalValue_True.snap | 3 +- ...ies_False_OverrideOptionalValue_False.snap | 3 +- ...ties_False_OverrideOptionalValue_True.snap | 3 +- ...ties_True_OverrideOptionalValue_False.snap | 3 +- ...rties_True_OverrideOptionalValue_True.snap | 3 +- ...ies_False_OverrideOptionalValue_False.snap | 3 +- ...ties_False_OverrideOptionalValue_True.snap | 3 +- ...ties_True_OverrideOptionalValue_False.snap | 3 +- ...rties_True_OverrideOptionalValue_True.snap | 3 +- ...ies_False_OverrideOptionalValue_False.snap | 3 +- ...ties_False_OverrideOptionalValue_True.snap | 3 +- ...ties_True_OverrideOptionalValue_False.snap | 3 +- ...rties_True_OverrideOptionalValue_True.snap | 3 +- ...ies_False_OverrideOptionalValue_False.snap | 3 +- ...ties_False_OverrideOptionalValue_True.snap | 3 +- ...ties_True_OverrideOptionalValue_False.snap | 3 +- ...rties_True_OverrideOptionalValue_True.snap | 3 +- ...ies_False_OverrideOptionalValue_False.snap | 3 +- ...ties_False_OverrideOptionalValue_True.snap | 3 +- ...ties_True_OverrideOptionalValue_False.snap | 3 +- ...rties_True_OverrideOptionalValue_True.snap | 3 +- ...ies_False_OverrideOptionalValue_False.snap | 3 +- ...ties_False_OverrideOptionalValue_True.snap | 3 +- ...ties_True_OverrideOptionalValue_False.snap | 3 +- ...rties_True_OverrideOptionalValue_True.snap | 3 +- ...ies_False_OverrideOptionalValue_False.snap | 3 +- ...ties_False_OverrideOptionalValue_True.snap | 3 +- ...ties_True_OverrideOptionalValue_False.snap | 3 +- ...rties_True_OverrideOptionalValue_True.snap | 3 +- ...ies_False_OverrideOptionalValue_False.snap | 3 +- ...ties_False_OverrideOptionalValue_True.snap | 3 +- ...ties_True_OverrideOptionalValue_False.snap | 3 +- ...rties_True_OverrideOptionalValue_True.snap | 3 +- ...ies_False_OverrideOptionalValue_False.snap | 3 +- ...ties_False_OverrideOptionalValue_True.snap | 3 +- ...ties_True_OverrideOptionalValue_False.snap | 3 +- ...rties_True_OverrideOptionalValue_True.snap | 3 +- ...ies_False_OverrideOptionalValue_False.snap | 3 +- ...ties_False_OverrideOptionalValue_True.snap | 3 +- ...ties_True_OverrideOptionalValue_False.snap | 3 +- ...rties_True_OverrideOptionalValue_True.snap | 3 +- ...ies_False_OverrideOptionalValue_False.snap | 3 +- ...ties_False_OverrideOptionalValue_True.snap | 3 +- ...ties_True_OverrideOptionalValue_False.snap | 3 +- ...rties_True_OverrideOptionalValue_True.snap | 3 +- ...ies_False_OverrideOptionalValue_False.snap | 3 +- ...ties_False_OverrideOptionalValue_True.snap | 3 +- ...ties_True_OverrideOptionalValue_False.snap | 3 +- ...rties_True_OverrideOptionalValue_True.snap | 3 +- ...ies_False_OverrideOptionalValue_False.snap | 3 +- ...ties_False_OverrideOptionalValue_True.snap | 3 +- ...ties_True_OverrideOptionalValue_False.snap | 3 +- ...rties_True_OverrideOptionalValue_True.snap | 3 +- ...ies_False_OverrideOptionalValue_False.snap | 3 +- ...ties_False_OverrideOptionalValue_True.snap | 3 +- ...ties_True_OverrideOptionalValue_False.snap | 3 +- ...rties_True_OverrideOptionalValue_True.snap | 3 +- ...ies_False_OverrideOptionalValue_False.snap | 3 +- ...ties_False_OverrideOptionalValue_True.snap | 3 +- ...ties_True_OverrideOptionalValue_False.snap | 3 +- ...rties_True_OverrideOptionalValue_True.snap | 3 +- ...ies_False_OverrideOptionalValue_False.snap | 3 +- ...ties_False_OverrideOptionalValue_True.snap | 3 +- ...ties_True_OverrideOptionalValue_False.snap | 3 +- ...rties_True_OverrideOptionalValue_True.snap | 3 +- ...ies_False_OverrideOptionalValue_False.snap | 3 +- ...ties_False_OverrideOptionalValue_True.snap | 3 +- ...ties_True_OverrideOptionalValue_False.snap | 3 +- ...rties_True_OverrideOptionalValue_True.snap | 3 +- ...ies_False_OverrideOptionalValue_False.snap | 3 +- ...ties_False_OverrideOptionalValue_True.snap | 3 +- ...ties_True_OverrideOptionalValue_False.snap | 3 +- ...rties_True_OverrideOptionalValue_True.snap | 3 +- ...ies_False_OverrideOptionalValue_False.snap | 3 +- ...ties_False_OverrideOptionalValue_True.snap | 3 +- ...ties_True_OverrideOptionalValue_False.snap | 3 +- ...rties_True_OverrideOptionalValue_True.snap | 3 +- ...ies_False_OverrideOptionalValue_False.snap | 3 +- ...ties_False_OverrideOptionalValue_True.snap | 3 +- ...ties_True_OverrideOptionalValue_False.snap | 3 +- ...rties_True_OverrideOptionalValue_True.snap | 3 +- ...ies_False_OverrideOptionalValue_False.snap | 3 +- ...ties_False_OverrideOptionalValue_True.snap | 3 +- ...ties_True_OverrideOptionalValue_False.snap | 3 +- ...rties_True_OverrideOptionalValue_True.snap | 3 +- ...ies_False_OverrideOptionalValue_False.snap | 3 +- ...ties_False_OverrideOptionalValue_True.snap | 3 +- ...ties_True_OverrideOptionalValue_False.snap | 3 +- ...rties_True_OverrideOptionalValue_True.snap | 3 +- ...ies_False_OverrideOptionalValue_False.snap | 3 +- ...ties_False_OverrideOptionalValue_True.snap | 3 +- ...ties_True_OverrideOptionalValue_False.snap | 3 +- ...rties_True_OverrideOptionalValue_True.snap | 3 +- ...ies_False_OverrideOptionalValue_False.snap | 3 +- ...ties_False_OverrideOptionalValue_True.snap | 3 +- ...ties_True_OverrideOptionalValue_False.snap | 3 +- ...rties_True_OverrideOptionalValue_True.snap | 3 +- ...ies_False_OverrideOptionalValue_False.snap | 3 +- ...ties_False_OverrideOptionalValue_True.snap | 3 +- ...ties_True_OverrideOptionalValue_False.snap | 3 +- ...rties_True_OverrideOptionalValue_True.snap | 3 +- ...ies_False_OverrideOptionalValue_False.snap | 3 +- ...ties_False_OverrideOptionalValue_True.snap | 3 +- ...ties_True_OverrideOptionalValue_False.snap | 3 +- ...rties_True_OverrideOptionalValue_True.snap | 3 +- ...ies_False_OverrideOptionalValue_False.snap | 3 +- ...ties_False_OverrideOptionalValue_True.snap | 3 +- ...ties_True_OverrideOptionalValue_False.snap | 3 +- ...rties_True_OverrideOptionalValue_True.snap | 3 +- ...ies_False_OverrideOptionalValue_False.snap | 3 +- ...ties_False_OverrideOptionalValue_True.snap | 3 +- ...ties_True_OverrideOptionalValue_False.snap | 3 +- ...rties_True_OverrideOptionalValue_True.snap | 3 +- ...ies_False_OverrideOptionalValue_False.snap | 3 +- ...ties_False_OverrideOptionalValue_True.snap | 3 +- ...ties_True_OverrideOptionalValue_False.snap | 3 +- ...rties_True_OverrideOptionalValue_True.snap | 3 +- ...ies_False_OverrideOptionalValue_False.snap | 3 +- ...ties_False_OverrideOptionalValue_True.snap | 3 +- ...ties_True_OverrideOptionalValue_False.snap | 3 +- ...rties_True_OverrideOptionalValue_True.snap | 3 +- ...ies_False_OverrideOptionalValue_False.snap | 3 +- ...ties_False_OverrideOptionalValue_True.snap | 3 +- ...ties_True_OverrideOptionalValue_False.snap | 3 +- ...rties_True_OverrideOptionalValue_True.snap | 3 +- ...ies_False_OverrideOptionalValue_False.snap | 3 +- ...ties_False_OverrideOptionalValue_True.snap | 3 +- ...ties_True_OverrideOptionalValue_False.snap | 3 +- ...rties_True_OverrideOptionalValue_True.snap | 3 +- ...ies_False_OverrideOptionalValue_False.snap | 3 +- ...ties_False_OverrideOptionalValue_True.snap | 3 +- ...ties_True_OverrideOptionalValue_False.snap | 3 +- ...rties_True_OverrideOptionalValue_True.snap | 3 +- ...ies_False_OverrideOptionalValue_False.snap | 3 +- ...ties_False_OverrideOptionalValue_True.snap | 3 +- ...ties_True_OverrideOptionalValue_False.snap | 3 +- ...rties_True_OverrideOptionalValue_True.snap | 3 +- 161 files changed, 2060 insertions(+), 2252 deletions(-) diff --git a/src/ClientGenerator/RoslynTypeResolver.cs b/src/ClientGenerator/RoslynTypeResolver.cs index e0881a4d..6a789111 100644 --- a/src/ClientGenerator/RoslynTypeResolver.cs +++ b/src/ClientGenerator/RoslynTypeResolver.cs @@ -1,1932 +1,1900 @@ -using EdjCase.ICP.ClientGenerator; -using Microsoft.CodeAnalysis.CSharp; -using Microsoft.CodeAnalysis; -using Microsoft.CodeAnalysis.CSharp.Syntax; -using System; -using System.Collections.Generic; -using System.Linq; -using EdjCase.ICP.Agent.Agents; -using EdjCase.ICP.Candid.Models; -using EdjCase.ICP.Candid.Mapping; -using EdjCase.ICP.Candid.Models.Values; -using EdjCase.ICP.Agent.Responses; -using System.Threading.Tasks; -using EdjCase.ICP.Candid; -using Org.BouncyCastle.Asn1.Cms; -using EdjCase.ICP.Candid.Models.Types; - -namespace EdjCase.ICP.ClientGenerator -{ - internal class RoslynTypeResolver - { - private readonly Dictionary _resolvedTypes = new(); - - public string ModelNamespace { get; } - public HashSet Aliases { get; } - public bool FeatureNullable { get; } - public bool VariantsUseProperties { get; } - public NameHelper NameHelper { get; } - public Dictionary DeclaredTypes { get; } - - public RoslynTypeResolver( - string modelNamespace, - HashSet aliases, - bool featureNullable, - bool variantsUseProperties, - NameHelper nameHelper, - Dictionary declaredTypes - ) - { - this.ModelNamespace = modelNamespace; - this.Aliases = aliases; - this.FeatureNullable = featureNullable; - this.VariantsUseProperties = variantsUseProperties; - this.NameHelper = nameHelper; - this.DeclaredTypes = declaredTypes; - } - - public ResolvedType ResolveTypeDeclaration( - string typeId, - string typeName, - SourceCodeType type - ) - { - // note that this only works for only one level of type nesting, so type aliases to generics whose argument is a user-defined type - // will fail, for example: - // type A = record { left : A, right : B }; - // type X = blob; - // type F = A; - - - if (this._resolvedTypes.TryGetValue(typeId, out ResolvedType? existing)) - { - return existing; - } - Stack parentTypeIds = new Stack(); - parentTypeIds.Push(typeId); - ResolvedType res = this.ResolveType(type, typeName, parentType: null, parentTypeIds); - this._resolvedTypes[typeId] = res; - return res; - } - - private ResolvedType ResolveType( - SourceCodeType type, - string nameContext, - TypeName? parentType, - Stack parentTypeIds - ) - { - switch (type) - { - case RawCandidType t: - { - CandidTypeTypeName typeName = new(t.CandidType); - return new ResolvedType(typeName); - } - case NonGenericSourceCodeType c: - { - var cType = new SimpleTypeName( - c.Type.Name, - c.Type.Namespace, - isDefaultNullable: c.Type.IsClass - ); - return new ResolvedType(cType); - } - case ListSourceCodeType l: - { - if (l.IsPredefinedType) - { - ResolvedType resolvedGenericType = this.ResolveType(l.ElementType, nameContext + "Item", parentType, parentTypeIds); - - var name = new ListTypeName(resolvedGenericType.Name); - return new ResolvedType(name, resolvedGenericType.GeneratedSyntax); - } - else - { - TypeName listName = this.BuildType(nameContext, parentType, isDefaultNullable: true); - ClassDeclarationSyntax syntax = this.GenerateList(listName, l, parentTypeIds); - return new ResolvedType(listName, new MemberDeclarationSyntax[] { syntax }); - } - } - case DictionarySourceCodeType d: - { - if (d.IsPredefinedType) - { - ResolvedType resolvedKeyType = this.ResolveType(d.KeyType, nameContext + "Key", parentType, parentTypeIds); - ResolvedType resolvedValueType = this.ResolveType(d.ValueType, nameContext + "Value", parentType, parentTypeIds); - MemberDeclarationSyntax[] generatedSyntax = (resolvedKeyType.GeneratedSyntax ?? Array.Empty()) - .Concat(resolvedValueType.GeneratedSyntax ?? Array.Empty()) - .ToArray(); ; - var name = new DictionaryTypeName(resolvedKeyType.Name, resolvedValueType.Name); - return new ResolvedType(name, generatedSyntax); - } - else - { - TypeName dictName = this.BuildType(nameContext, parentType, isDefaultNullable: true); - ClassDeclarationSyntax syntax = this.GenerateDictionary(dictName, d, parentTypeIds); - return new ResolvedType(dictName, new MemberDeclarationSyntax[] { syntax }); - } - } - case TupleSourceCodeType t: - { - List resolvedGenericTypes = t.Fields - .Select((f, i) => this.ResolveType(f, nameContext + "Value_" + i, parentType, parentTypeIds)) - .ToList(); - List elementTypeNames = resolvedGenericTypes - .Select(f => f.Name) - .ToList(); - MemberDeclarationSyntax[] generatedSyntax = resolvedGenericTypes - .SelectMany(t => t.GeneratedSyntax ?? Array.Empty()) - .ToArray(); - var name = new TupleTypeName(elementTypeNames); - return new ResolvedType(name, generatedSyntax); - } - case OptionalValueSourceCodeType v: - { - TypeName name; - if (v.IsPredefinedType) - { - ResolvedType resolvedGenericType = this.ResolveType(v.GenericType, nameContext + "Value", parentType, parentTypeIds); - name = new OptionalValueTypeName(resolvedGenericType.Name); - return new ResolvedType(name, resolvedGenericType.GeneratedSyntax); - } - else - { - TypeName oValueName = this.BuildType(nameContext, parentType, isDefaultNullable: true); - ClassDeclarationSyntax syntax = this.GenerateOptionalValue(oValueName, v, parentTypeIds); - return new ResolvedType(oValueName, new MemberDeclarationSyntax[] { syntax }); - } - } - case ArraySourceCodeType a: - { - if (a.ElementType == null) - { - return new ResolvedType(new ArrayTypeName(null)); - } - ResolvedType resolvedGenericType = this.ResolveType(a.ElementType, nameContext + "Item", parentType, parentTypeIds); - - var name = new ArrayTypeName(resolvedGenericType.Name); - return new ResolvedType(name, resolvedGenericType.GeneratedSyntax); - } - case ReferenceSourceCodeType re: - { - bool isAlias = this.Aliases.Contains(re.Id.Value); - (string name, SourceCodeType sourceCodeType) = this.DeclaredTypes[re.Id.Value]; - - string? @namespace = isAlias ? null : this.ModelNamespace; - TypeName typeName = new SimpleTypeName( - name, - @namespace, - true // TODO - ); - return new ResolvedType(typeName); - - } - case VariantSourceCodeType v: - { - TypeName variantName = this.BuildType(nameContext, parentType, isDefaultNullable: true); - (ClassDeclarationSyntax? ClassSyntax, EnumDeclarationSyntax EnumSyntax) result = this.GenerateVariant(variantName, v, parentType, parentTypeIds); - if (result.ClassSyntax != null) - { - return new ResolvedType(variantName, new MemberDeclarationSyntax[] { result.ClassSyntax, result.EnumSyntax }); - } - return new ResolvedType(variantName, new MemberDeclarationSyntax[] { result.EnumSyntax }); - } - case RecordSourceCodeType r: - { - TypeName recordName = this.BuildType(nameContext, parentType, isDefaultNullable: true); - ClassDeclarationSyntax classSyntax = this.GenerateRecord(recordName, r, parentTypeIds); - return new ResolvedType(recordName, new MemberDeclarationSyntax[] { classSyntax }); - } - default: - throw new NotImplementedException(); - } - } - - - public ClassDeclarationSyntax GenerateClient( - TypeName clientName, - ServiceSourceCodeType service) - { - string candidConverterProperty = "Converter"; - List properties = new() - { - // public IAgent Agent { get; } - new ClassProperty( - name: "Agent", - type: SimpleTypeName.FromType(), - access: AccessType.Public, - hasSetter: false - ), - - // public Principal CanisterId { get; } - new ClassProperty( - name: "CanisterId", - type: SimpleTypeName.FromType(), - access: AccessType.Public, - hasSetter: false - ), - }; - - List optionalProperties = new() - { - // public CandidConverter? Converter { get; } - new ClassProperty( - name: candidConverterProperty, - type: SimpleTypeName.FromType(isNullable: this.FeatureNullable), - access: AccessType.Public, - hasSetter: false - ) - }; - - Stack parentTypeIds = new(); - List<(MethodDeclarationSyntax Method, List SubTypes)> methods = service.Methods - .Select(method => this.GenerateFuncMethod(method.CsharpName, method.CandidName, method.FuncInfo, clientName, this, candidConverterProperty, parentTypeIds)) - .ToList(); - - return this.GenerateClass( - clientName, - properties, - optionalProperties: optionalProperties, - methods: methods.Select(m => m.Method).ToList(), - subTypes: methods.SelectMany(m => m.SubTypes).ToList() - ); - } - - internal ClassDeclarationSyntax GenerateOptionalValue( - TypeName oValueName, - OptionalValueSourceCodeType v, - Stack parentTypeIds - ) - { - string parentName = oValueName.BuildName(this.FeatureNullable, false, true); - ResolvedType resolvedGenericType = this.ResolveType(v.GenericType, parentName + "Value", oValueName, parentTypeIds); - List properties = new(); - List methods = new(); - - var constructorProps = new List<(string Name, TypeName Type, bool SetValue)> - { - ("value", resolvedGenericType.Name, false) - }; - var constructor = this.GenerateConstructor(oValueName, AccessType.Public, constructorProps) - .WithInitializer(SyntaxFactory.ConstructorInitializer( - SyntaxKind.BaseConstructorInitializer, - SyntaxFactory.ArgumentList( - SyntaxFactory.SingletonSeparatedList( - SyntaxFactory.Argument( - SyntaxFactory.IdentifierName("value") - ) - ) - ) - )); - List subTypes = new() - { - constructor - }; - if (resolvedGenericType.GeneratedSyntax?.Any() == true) - { - subTypes.AddRange(resolvedGenericType.GeneratedSyntax); - } - return this.GenerateClass( - name: oValueName, - properties: properties, - optionalProperties: null, - customProperties: null, - methods: methods, - attributes: null, - emptyConstructorAccess: AccessType.Public, - subTypes: subTypes, - implementTypes: new List - { - new OptionalValueTypeName(resolvedGenericType.Name) - } - ); - } - - internal ClassDeclarationSyntax GenerateList( - TypeName listName, - ListSourceCodeType type, - Stack parentTypeIds - ) - { - string parentName = listName.BuildName(this.FeatureNullable, false, true); - ResolvedType elementType = this.ResolveType(type.ElementType, parentName + "Element", listName, parentTypeIds); - - List properties = new(); - List methods = new(); - return this.GenerateClass( - name: listName, - properties: properties, - optionalProperties: null, - customProperties: null, - methods: methods, - attributes: null, - emptyConstructorAccess: AccessType.Public, - subTypes: elementType.GeneratedSyntax?.ToList(), - implementTypes: new List - { - new ListTypeName(elementType.Name) - } - ); - } - - internal ClassDeclarationSyntax GenerateDictionary( - TypeName dictName, - DictionarySourceCodeType type, - Stack parentTypeIds - ) - { - string parentName = dictName.BuildName(this.FeatureNullable, false, true); - ResolvedType keyType = this.ResolveType(type.KeyType, parentName + "Key", dictName, parentTypeIds); - ResolvedType valueType = this.ResolveType(type.ValueType, parentName + "Value", dictName, parentTypeIds); - - List properties = new(); - List methods = new(); - List subTypes = new(); - if (keyType.GeneratedSyntax != null) - { - subTypes.AddRange(keyType.GeneratedSyntax); - } - if (valueType.GeneratedSyntax != null) - { - subTypes.AddRange(valueType.GeneratedSyntax); - } - return this.GenerateClass( - name: dictName, - properties: properties, - optionalProperties: null, - customProperties: null, - methods: methods, - attributes: null, - emptyConstructorAccess: AccessType.Public, - subTypes: subTypes, - implementTypes: new List - { - new DictionaryTypeName(keyType.Name, valueType.Name) - } - ); - } - - - internal (ClassDeclarationSyntax? Class, EnumDeclarationSyntax Type) GenerateVariant( - TypeName variantTypeName, - VariantSourceCodeType variant, - TypeName? parentType, - Stack parentTypeIds - ) - { - (ResolvedName Name, ResolvedType? Type, bool OptionalOverridden) ResolveOption(VariantSourceCodeType.VariantOption option, int i) - { - ResolvedType? resolvedType; - if (option.Type == null) - { - resolvedType = null; - } - else - { - string nameContext = option.Type.IsPredefinedType - ? option.Tag.Name - : option.Tag.Name + "Info"; // If need to generate sub type, add suffix to avoid name collision - resolvedType = this.ResolveType(option.Type, nameContext, variantTypeName, parentTypeIds); - } - return (option.Tag, resolvedType, option.OptionalOverridden); - } - - - List<(ResolvedName Name, ResolvedType? Type, bool OptionalOverridden)> resolvedOptions = variant.Options - .Select(ResolveOption) - .ToList(); - - List<(ResolvedName Name, TypeName? Type)> enumOptions = resolvedOptions - .Select(o => (o.Name, o.Type?.Name)) - .ToList(); - - if (enumOptions.All(o => o.Type == null)) - { - // If there are no types, just create an enum value - - TypeName enumTypeName = this.BuildType(variantTypeName.BuildName(this.FeatureNullable, false), parentType, isDefaultNullable: false); - EnumDeclarationSyntax enumSyntax = this.GenerateEnum(enumTypeName, enumOptions); - return (null, enumSyntax); - } - else - { - TypeName enumTypeName = this.BuildType(variantTypeName.BuildName(this.FeatureNullable, false) + "Tag", parentType, isDefaultNullable: false); - - // TODO auto change the property values of all class types if it matches the name - bool containsClashingTag = variantTypeName.BuildName(this.FeatureNullable, false) == "Tag" - || variant.Options.Any(o => o.Tag.Name == "Tag"); - string tagName = containsClashingTag ? "Tag_" : "Tag"; - - bool containsClashingValue = variantTypeName.BuildName(this.FeatureNullable, false) == "Value" - || variant.Options.Any(o => o.Tag.Name == "Value"); - string valueName = containsClashingValue ? "Value_" : "Value"; - - List properties = new() - { - new ClassProperty( - tagName, - enumTypeName, - access: AccessType.Public, - hasSetter: true, - AttributeInfo.FromType() - ), - new ClassProperty( - valueName, - SimpleTypeName.FromType(isNullable: this.FeatureNullable), - access: AccessType.Public, - hasSetter: true, - AttributeInfo.FromType() - ) - }; - List methods; - List? customProperties; - if (!this.VariantsUseProperties) - { - methods = this.GenerateVariantMethods( - variantTypeName, - enumTypeName, - valueName, - tagName, - resolvedOptions - ); - customProperties = null; - } - else - { - methods = new List(); - - customProperties = this.GenerateVariantProperties( - variantTypeName, - enumTypeName, - valueName, - tagName, - resolvedOptions - ); - } - - List attributes = new() - { - // [Variant] - this.GenerateAttribute(AttributeInfo.FromType()) - }; - ClassDeclarationSyntax classSyntax = this.GenerateClass( - name: variantTypeName, - properties: properties, - optionalProperties: null, - customProperties: customProperties, - methods: methods, - attributes: attributes, - emptyConstructorAccess: AccessType.Protected, - subTypes: resolvedOptions - .SelectMany(o => o.Type?.GeneratedSyntax ?? Array.Empty()) - .ToList() - ); - EnumDeclarationSyntax enumSyntax = this.GenerateEnum(enumTypeName, enumOptions); - return (classSyntax, enumSyntax); - } - } - - private List GenerateVariantProperties( - TypeName variantTypeName, - TypeName enumTypeName, - string valueName, - string tagName, - List<(ResolvedName Name, ResolvedType? Type, bool OptionalOverridden)> resolvedOptions - ) - { - // Properties with types - // public {OptionType}? {OptionName} { - // get => this.Tag == {EnumName}.{OptionName} ? ({OptionType})this.Value : default; - // set => (this.Tag, this.Value) = ({EnumName}.{OptionName}, value); - // } - return resolvedOptions - .Where(o => o.Type != null) - .Select(o => - { - List attributeSyntaxList = new(); - if (o.OptionalOverridden) - { - attributeSyntaxList.Add(this.GenerateAttribute(AttributeInfo.FromType())); - } - CandidType? candidType = o.Type!.Name.GetCandidType(); - if (candidType != null) - { - // [CandidTypeDefinition("{typeDefinition}")] - string candidTypeDefinition = CandidTextGenerator.Generate(candidType, indentType: CandidTextGenerator.IndentType.None); - attributeSyntaxList.Add(this.GenerateAttribute(AttributeInfo.FromType(candidTypeDefinition))); - } - - List accessors = new() - { - // Add getter - SyntaxFactory - .AccessorDeclaration(SyntaxKind.GetAccessorDeclaration) - .WithExpressionBody(SyntaxFactory.ArrowExpressionClause( - SyntaxFactory.ConditionalExpression( - // this.Tag == {EnumName}.{OptionName} - SyntaxFactory.BinaryExpression( - SyntaxKind.EqualsExpression, - SyntaxFactory.MemberAccessExpression( - SyntaxKind.SimpleMemberAccessExpression, - SyntaxFactory.ThisExpression(), - SyntaxFactory.IdentifierName(tagName) - ), - SyntaxFactory.MemberAccessExpression( - SyntaxKind.SimpleMemberAccessExpression, - enumTypeName.ToTypeSyntax(this.FeatureNullable), - SyntaxFactory.IdentifierName(o.Name.Name) - ) - ), - // ({OptionType}) this.Value! - SyntaxFactory.CastExpression( - o.Type!.Name.ToTypeSyntax(this.FeatureNullable), - SyntaxFactory.PostfixUnaryExpression( - SyntaxKind.SuppressNullableWarningExpression, - SyntaxFactory.MemberAccessExpression( - SyntaxKind.SimpleMemberAccessExpression, - SyntaxFactory.ThisExpression(), - SyntaxFactory.IdentifierName(valueName) - ) - ) - - ), - // default - SyntaxFactory.LiteralExpression( - SyntaxKind.DefaultLiteralExpression, - SyntaxFactory.Token(SyntaxKind.DefaultKeyword) - ) - ) - )) - .WithSemicolonToken( - SyntaxFactory.Token(SyntaxKind.SemicolonToken) - ), - // Add setter - SyntaxFactory - .AccessorDeclaration(SyntaxKind.SetAccessorDeclaration) - .WithExpressionBody(SyntaxFactory.ArrowExpressionClause( - SyntaxFactory.AssignmentExpression( - SyntaxKind.SimpleAssignmentExpression, - SyntaxFactory.TupleExpression( - SyntaxFactory.SeparatedList( - new SyntaxNodeOrToken[]{ - SyntaxFactory.Argument( - SyntaxFactory.MemberAccessExpression( - SyntaxKind.SimpleMemberAccessExpression, - SyntaxFactory.ThisExpression(), - SyntaxFactory.IdentifierName(tagName) - ) - ), - SyntaxFactory.Token(SyntaxKind.CommaToken), - SyntaxFactory.Argument( - SyntaxFactory.MemberAccessExpression( - SyntaxKind.SimpleMemberAccessExpression, - SyntaxFactory.ThisExpression(), - SyntaxFactory.IdentifierName(valueName) - ) - ) - } - ) - ), - SyntaxFactory.TupleExpression( - SyntaxFactory.SeparatedList( - new SyntaxNodeOrToken[]{ - SyntaxFactory.Argument( - SyntaxFactory.MemberAccessExpression( - SyntaxKind.SimpleMemberAccessExpression, - enumTypeName.ToTypeSyntax(this.FeatureNullable), - SyntaxFactory.IdentifierName(o.Name.Name) - ) - ), - SyntaxFactory.Token(SyntaxKind.CommaToken), - SyntaxFactory.Argument( - SyntaxFactory.IdentifierName("value") - ) - } - ) - ) - ) - )) - .WithSemicolonToken( - SyntaxFactory.Token(SyntaxKind.SemicolonToken) - ) - }; - TypeName fixedTypeName = new NullableTypeName(o.Type.Name); - return SyntaxFactory.PropertyDeclaration( - fixedTypeName.ToTypeSyntax(this.FeatureNullable), - o.Name.Name - ) - .WithModifiers( - SyntaxFactory.TokenList( - SyntaxFactory.Token(SyntaxKind.PublicKeyword) - ) - ) - .WithAccessorList(SyntaxFactory.AccessorList( - SyntaxFactory.List(accessors) - )) - .WithAttributeLists(SyntaxFactory.List(attributeSyntaxList)); - }) - .ToList(); - - } - - private List GenerateVariantMethods( - TypeName variantTypeName, - TypeName enumTypeName, - string valueName, - string tagName, - List<(ResolvedName Name, ResolvedType? Type, bool OptionalOverridden)> resolvedOptions - ) - { - // Creation methods - // public static {VariantType} {OptionName}({VariantOptionType} value) - // or if there is no type: - // public static {VariantType} {OptionName}() - List methods = resolvedOptions - .Select(o => this.GenerateVariantOptionCreationMethod( - variantTypeName, - enumTypeName, - o.Name, - o.Type, - "info", - o.OptionalOverridden - )) - .ToList(); - - - // 'As{X}' methods (if has option type) - methods.AddRange( - resolvedOptions - .Where(r => r.Type != null) - .Select(o => this.GenerateVariantOptionAsMethod(enumTypeName, o.Name, o.Type!, valueName, o.OptionalOverridden)) - ); - - - bool anyOptionsWithType = resolvedOptions.Any(o => o.Type != null); - if (anyOptionsWithType) - { - // If there are any types, then create the helper method 'ValidateType' that - // they all use - methods.Add(this.GenerateVariantValidateTypeMethod(enumTypeName, tagName)); - } - return methods; - } - - private TypeName BuildType(string name, TypeName? parentType, bool isDefaultNullable) - { - string @namespace; - if (parentType == null) - { - @namespace = this.ModelNamespace; - return new SimpleTypeName(name, @namespace, isDefaultNullable); - } - return new NestedTypeName(parentType, name); - } - - private MethodDeclarationSyntax GenerateVariantValidateTypeMethod( - TypeName enumTypeName, - string tagName - ) - { - // Generate helper function to validate the variant 'As_' methods - //private void ValidateTag({VariantEnum} tag) - //{ - // if (!this.Tag.Equals(tag)) - // { - // throw new InvalidOperationException($"Cannot cast '{this.Tag}' to type '{tag}'"); - // } - //} - string argName = this.NameHelper.ToCamelCase(tagName); - BlockSyntax body = SyntaxFactory.Block( - SyntaxFactory.IfStatement( - SyntaxFactory.PrefixUnaryExpression( - SyntaxKind.LogicalNotExpression, - SyntaxFactory.InvocationExpression( - SyntaxFactory.MemberAccessExpression( - SyntaxKind.SimpleMemberAccessExpression, - SyntaxFactory.MemberAccessExpression( - SyntaxKind.SimpleMemberAccessExpression, - SyntaxFactory.ThisExpression(), - SyntaxFactory.IdentifierName(tagName) - ), - SyntaxFactory.IdentifierName(nameof(CandidTag.Equals)) - ) - ) - .WithArgumentList( - SyntaxFactory.ArgumentList( - SyntaxFactory.SingletonSeparatedList( - SyntaxFactory.Argument( - SyntaxFactory.IdentifierName(argName) - ) - ) - ) - ) - ), - SyntaxFactory.Block( - SyntaxFactory.SingletonList( - SyntaxFactory.ThrowStatement( - SyntaxFactory.ObjectCreationExpression( - SyntaxFactory.IdentifierName(typeof(InvalidOperationException).FullName!) - ) - .WithArgumentList( - SyntaxFactory.ArgumentList( - SyntaxFactory.SingletonSeparatedList( - SyntaxFactory.Argument( - SyntaxFactory.InterpolatedStringExpression( - SyntaxFactory.Token(SyntaxKind.InterpolatedStringStartToken) - ) - .WithContents( - SyntaxFactory.List( - new InterpolatedStringContentSyntax[]{ - SyntaxFactory.InterpolatedStringText() - .WithTextToken( - SyntaxFactory.Token( - SyntaxFactory.TriviaList(), - SyntaxKind.InterpolatedStringTextToken, - "Cannot cast '", - "Cannot cast '", - SyntaxFactory.TriviaList() - ) - ), - SyntaxFactory.Interpolation( - SyntaxFactory.MemberAccessExpression( - SyntaxKind.SimpleMemberAccessExpression, - SyntaxFactory.ThisExpression(), - SyntaxFactory.IdentifierName(tagName) - ) - ), - SyntaxFactory.InterpolatedStringText() - .WithTextToken( - SyntaxFactory.Token( - SyntaxFactory.TriviaList(), - SyntaxKind.InterpolatedStringTextToken, - "' to type '", - "' to type '", - SyntaxFactory.TriviaList() - ) - ), - SyntaxFactory.Interpolation( - SyntaxFactory.IdentifierName(argName) - ), - SyntaxFactory.InterpolatedStringText() - .WithTextToken( - SyntaxFactory.Token( - SyntaxFactory.TriviaList(), - SyntaxKind.InterpolatedStringTextToken, - "'", - "'", - SyntaxFactory.TriviaList() - ) - ) - } - ) - ) - ) - ) - ) - ) - ) - ) - ) - )); - return this.GenerateMethod( - body: body, - access: AccessType.Private, - isStatic: false, - isAsync: false, - returnTypes: null, - name: "ValidateTag", - attributes: null, - (enumTypeName, "tag") - ); - } - - private MethodDeclarationSyntax GenerateVariantOptionAsMethod( - TypeName enumType, - ResolvedName optionName, - ResolvedType optionType, - string valueName, - bool optionalOverridden - ) - { - // public {VariantOptionType} As{OptionName}() - // { - // this.ValidateTag({EnumType}.{Option}); - // return ({VariantOptionType})this.Value!; - // } - BlockSyntax body = SyntaxFactory.Block( - SyntaxFactory.ExpressionStatement( - SyntaxFactory.InvocationExpression( - SyntaxFactory.MemberAccessExpression( - SyntaxKind.SimpleMemberAccessExpression, - SyntaxFactory.ThisExpression(), - SyntaxFactory.IdentifierName("ValidateTag") - ) - ) - .WithArgumentList( - SyntaxFactory.ArgumentList( - SyntaxFactory.SingletonSeparatedList( - SyntaxFactory.Argument( - SyntaxFactory.MemberAccessExpression( - SyntaxKind.SimpleMemberAccessExpression, - enumType.ToTypeSyntax(this.FeatureNullable), - SyntaxFactory.IdentifierName(optionName.Name) - ) - ) - ) - ) - ) - ), - SyntaxFactory.ReturnStatement( - SyntaxFactory.CastExpression( - optionType.Name.ToTypeSyntax(this.FeatureNullable), - SyntaxFactory.PostfixUnaryExpression( - SyntaxKind.SuppressNullableWarningExpression, - SyntaxFactory.MemberAccessExpression( - SyntaxKind.SimpleMemberAccessExpression, - SyntaxFactory.ThisExpression(), - SyntaxFactory.IdentifierName(valueName) - ) - ) - ) - ) - ); - TypeName returnTypeName = optionType.Name; - List? attributes = null; - if (optionalOverridden) - { - // [CandidOptional] - attributes = new List - { - AttributeInfo.FromType() - }; - // Add '?' if applicible - returnTypeName = new NullableTypeName(returnTypeName); - } - CandidType? candidType = returnTypeName.GetCandidType(); - if (candidType != null) - { - // [CandidTypeDefinition("{typeDefinition}")] - attributes ??= new List(); - string candidTypeDefinition = CandidTextGenerator.Generate(candidType, indentType: CandidTextGenerator.IndentType.None); - attributes.Add(AttributeInfo.FromType(candidTypeDefinition)); - } - - return this.GenerateMethod( - body: body, - access: AccessType.Public, - isStatic: false, - isAsync: false, - returnTypes: new List { new TypedValueName(returnTypeName, optionName) }, - name: "As" + optionName.Name, - attributes: attributes - ); - } - - private MethodDeclarationSyntax GenerateVariantOptionCreationMethod( - TypeName variantTypeName, - TypeName enumTypeName, - ResolvedName optionTypeName, - ResolvedType? optionType, - string optionValueParamName, - bool optionalOverridden - ) - { - ExpressionSyntax arg = optionType == null - // If option type is not specified, then use `null` - ? SyntaxFactory.LiteralExpression(SyntaxKind.NullLiteralExpression) - // If option type is specified, then use param - : SyntaxFactory.IdentifierName(optionValueParamName); - - var creationParameters = new List<(TypeName, string)>(); - if (optionType != null) - { - TypeName t = optionType.Name; - if (optionalOverridden) - { - // Add '?' if applicible - t = new NullableTypeName(t); - } - creationParameters.Add((t, optionValueParamName)); - } - string methodName = optionTypeName.Name == variantTypeName.BuildName(this.FeatureNullable, false) - ? optionTypeName.Name + "_" // Escape colliding names - : optionTypeName.Name; - return this.GenerateMethod( - // return new {VariantType}({VariantEnum}.{Option}, value); - body: SyntaxFactory.Block( - SyntaxFactory.ReturnStatement( - SyntaxFactory.ObjectCreationExpression( - variantTypeName.ToTypeSyntax(false) - ) - .WithArgumentList( - SyntaxFactory.ArgumentList( - SyntaxFactory.SeparatedList( - new SyntaxNodeOrToken[]{ - SyntaxFactory.Argument( - SyntaxFactory.MemberAccessExpression( - SyntaxKind.SimpleMemberAccessExpression, - enumTypeName.ToTypeSyntax(this.FeatureNullable), - SyntaxFactory.IdentifierName(optionTypeName.Name) - ) - ), - SyntaxFactory.Token(SyntaxKind.CommaToken), - SyntaxFactory.Argument(arg) - } - ) - ) - ) - ) - ), - access: AccessType.Public, - isStatic: true, - isAsync: false, - returnTypes: new List { new TypedValueName(variantTypeName, optionTypeName) }, - name: methodName, - attributes: null, - parameters: creationParameters?.ToArray() ?? Array.Empty<(TypeName, string)>() - ); - } - - internal ClassDeclarationSyntax GenerateRecord( - TypeName recordTypeName, - RecordSourceCodeType record, - Stack parentTypeIds - ) - { - (ResolvedName Name, ResolvedType Type, bool OptionalOverridden) ResolveField(RecordSourceCodeType.RecordField option, int i) - { - string nameContext = option.Type.IsPredefinedType - ? option.Tag.Name - : option.Tag.Name + "Info"; // If need to generate sub type, add suffix to avoid name collision - ResolvedType resolvedType = this.ResolveType(option.Type, nameContext, recordTypeName, parentTypeIds); - return (option.Tag, resolvedType, option.OptionalOverridden); - } - List<(ResolvedName Tag, ResolvedType Type, bool OptionalOverridden)> resolvedFields = record.Fields - .Select(ResolveField) - .ToList(); - List subItems = resolvedFields - .SelectMany(f => f.Type.GeneratedSyntax ?? Array.Empty()) - .ToList(); - - List properties = resolvedFields - .Select((f, i) => - { - ResolvedName propertyName = f.Tag; - if (propertyName.Name == recordTypeName.BuildName(this.FeatureNullable, false)) - { - // Cant match the class name - propertyName = new ResolvedName( - name: propertyName.Name + "_", // TODO best way to escape it. @ does not work - candidTag: propertyName.CandidTag - ); - } - List attributes = new List(); - if (propertyName.CandidTag.Name == null) - { - // [CandidTag({candidTag})] - // Indicate there is no associated name, just an id - // Usually with tuples like 'record { text; nat; }' - attributes.Add(AttributeInfo.FromType(propertyName.CandidTag)); - } - else if (propertyName.CandidTag != propertyName.Name) - { - // [CandidName("{fieldCandidName}")] - // Only add attribute if the name is different - attributes.Add(AttributeInfo.FromType(propertyName.CandidTag.Name!)); - } - TypeName typeName = f.Type.Name; - if (f.OptionalOverridden) - { - // [CandidOptional] - attributes.Add(AttributeInfo.FromType()); - // Add '?' if applicible - typeName = new NullableTypeName(typeName); - } - CandidType? candidType = typeName.GetCandidType(); - if (candidType != null) - { - // [CandidTypeDefinition("{typeDefinition}")] - string candidTypeDefinition = CandidTextGenerator.Generate(candidType, indentType: CandidTextGenerator.IndentType.None); - attributes.Add(AttributeInfo.FromType(candidTypeDefinition)); - } - - - - // public {fieldType} {fieldName} {{ get; set; }} - return new ClassProperty( - name: propertyName.Name, - type: typeName, - access: AccessType.Public, - hasSetter: true, - attributes.ToArray() - ); - }) - .ToList(); - - return this.GenerateClass( - name: recordTypeName, - properties: properties, - optionalProperties: null, - subTypes: subItems, - emptyConstructorAccess: AccessType.Public - ); - - } - - private PropertyDeclarationSyntax? GenerateProperty(ClassProperty property) - { - if (property.Type == null) - { - return null; - } - List accessors = new() - { - // Add get in `{ get; } - SyntaxFactory - .AccessorDeclaration(SyntaxKind.GetAccessorDeclaration) - .WithSemicolonToken(SyntaxFactory.Token(SyntaxKind.SemicolonToken)) - }; - if (property.HasSetter) - { - // Add set in `{ get; set; }` - accessors.Add( - SyntaxFactory - .AccessorDeclaration(SyntaxKind.SetAccessorDeclaration) - .WithSemicolonToken(SyntaxFactory.Token(SyntaxKind.SemicolonToken)) - ); - } - - PropertyDeclarationSyntax propertySyntax = SyntaxFactory - .PropertyDeclaration( - property.Type.ToTypeSyntax(this.FeatureNullable), - SyntaxFactory.Identifier(property.Name) - ) - .WithAccessorList(SyntaxFactory.AccessorList( - SyntaxFactory.List(accessors) - )); - - // Add `public`, `private`, etc... - SyntaxToken? accessSyntaxToken = this.GenerateAccessToken(property.Access); - if (accessSyntaxToken != null) - { - propertySyntax = propertySyntax - .WithModifiers(SyntaxTokenList.Create(accessSyntaxToken.Value)); - } - if (property.Attributes?.Any() == true) - { - IEnumerable attributes = property.Attributes - .Select(a => this.GenerateAttribute(a)); - propertySyntax = propertySyntax - .WithAttributeLists(SyntaxFactory.List(attributes)); - } - - return propertySyntax; - } - - private EnumDeclarationSyntax GenerateEnum(TypeName enumName, List<(ResolvedName Name, TypeName? Type)> values) - { - // Build enum options based on the values - IEnumerable enumOptions = values - .Select(v => - { - List attributeList = new(); - - if (v.Name.CandidTag.Name == null) - { - // [CandidTagId({candidTagId})] - // Indicate there is no associated name, just an id - // Usually with tuples like 'record { text; nat; }' - attributeList.Add(this.GenerateAttribute( - new AttributeInfo(SimpleTypeName.FromType(), v.Name.CandidTag.Id) - )); - } - else if (v.Name.CandidTag.Name != v.Name.Name) - { - // [CandidName({candidName}] - // Only add if names differ - attributeList.Add(this.GenerateAttribute( - new AttributeInfo(SimpleTypeName.FromType(), v.Name.CandidTag.Name!) - )); - } - return SyntaxFactory - // {optionName}, - .EnumMemberDeclaration(SyntaxFactory.Identifier(v.Name.Name)) - // Add attributes - .WithAttributeLists(SyntaxFactory.List(attributeList)); - }); - - // Create comma seperators between the enum options - IEnumerable enumSeperators = Enumerable.Range(0, values.Count - 1) - .Select(i => SyntaxFactory.Token(SyntaxKind.CommaToken)); - - // public enum {enumName} - return SyntaxFactory.EnumDeclaration(enumName.BuildName(this.FeatureNullable, false)) - .WithModifiers( - // public - SyntaxFactory.TokenList(SyntaxFactory.Token(SyntaxKind.PublicKeyword)) - ) - .WithMembers( - // Each enum option - SyntaxFactory.SeparatedList(enumOptions, enumSeperators) - ); - } - - - - private AttributeListSyntax GenerateAttribute(AttributeInfo attribute) - { - IEnumerable? arguments = attribute.Args? - .Select(a => - { - return a switch - { - string s => SyntaxFactory.LiteralExpression( - SyntaxKind.StringLiteralExpression, - SyntaxFactory.Literal(s) - ), - uint i => SyntaxFactory.LiteralExpression( - SyntaxKind.NumericLiteralExpression, - SyntaxFactory.Literal(i) - ), - CandidTag t => t.Name != null - ? SyntaxFactory.LiteralExpression( - SyntaxKind.StringLiteralExpression, - SyntaxFactory.Literal(t.Name) - ) - : SyntaxFactory.LiteralExpression( - SyntaxKind.NumericLiteralExpression, - SyntaxFactory.Literal(t.Id) - ), - TypeName type => SyntaxFactory.TypeOfExpression(type.ToTypeSyntax(this.FeatureNullable)), - _ => throw new NotImplementedException() - }; - }) - .Select(SyntaxFactory.AttributeArgument); - - string typeName = attribute.Type.BuildName(this.FeatureNullable, true); - typeName = typeName[..^"Attribute".Length]; // Remove suffix - AttributeSyntax syntax = SyntaxFactory.Attribute(SyntaxFactory.IdentifierName(typeName)); - if (arguments?.Any() == true) - { - syntax = syntax.WithArgumentList( - SyntaxFactory.AttributeArgumentList( - SyntaxFactory.SeparatedList(arguments) - ) - ); - } - - return SyntaxFactory.AttributeList( - SyntaxFactory.SingletonSeparatedList( - syntax - ) - ); - } - - private (MethodDeclarationSyntax Method, List SubTypes) GenerateFuncMethod( - string csharpName, - string candidName, - ServiceSourceCodeType.Func info, - TypeName clientName, - RoslynTypeResolver typeResolver, - string candidConverterProperty, - Stack parentTypeIds - ) - { - (ResolvedName Name, ResolvedType Type) ResolveType((ResolvedName Name, SourceCodeType Type) type, int i) - { - string nameContext = StringUtil.ToPascalCase(csharpName) + StringUtil.ToPascalCase(type.Name.Name); - ResolvedType resolvedType = typeResolver.ResolveType(type.Type, nameContext, parentType: clientName, parentTypeIds); - return (type.Name, resolvedType); - } - - List<(ResolvedName Name, ResolvedType Type)> resolvedArgTypes = info.ArgTypes - .Select(ResolveType) - .ToList(); - List<(ResolvedName Name, ResolvedType Type)> resolvedReturnTypes = info.ReturnTypes - .Select(ResolveType) - .ToList(); - - List<(TypeName, string)> argTypes = resolvedArgTypes - .Select(t => (t.Type.Name, t.Name.ToCamelCase())) - .ToList(); - List returnTypes = resolvedReturnTypes - .Select(t => new TypedValueName(t.Type.Name, t.Name)) - .ToList(); - - BlockSyntax body = this.GenerateFuncMethodBody( - candidName: candidName, - argTypes, - returnTypes, - isOneway: info.IsOneway, - isQuery: info.IsQuery, - typeResolver: typeResolver, - candidConverterProperty - ); - List subTypes = resolvedArgTypes - .Where(t => t.Type.GeneratedSyntax != null) - .SelectMany(t => t.Type.GeneratedSyntax!) - .Concat(resolvedReturnTypes - .Where(t => t.Type.GeneratedSyntax != null) - .SelectMany(t => t.Type.GeneratedSyntax!) - ) - .ToList(); - - MethodDeclarationSyntax method = this.GenerateMethod( - body: body, - access: AccessType.Public, - isStatic: false, - isAsync: true, - returnTypes: returnTypes, - name: csharpName, - attributes: null, - parameters: argTypes.ToArray() - ); - return (method, subTypes); - } - - private BlockSyntax GenerateFuncMethodBody( - string candidName, - List<(TypeName Type, string Name)> argTypes, - List returnTypes, - bool isOneway, - bool isQuery, - RoslynTypeResolver typeResolver, - string candidConverterProperty - ) - { - ArgumentSyntax converterArg = SyntaxFactory.Argument( - SyntaxFactory.MemberAccessExpression( - SyntaxKind.SimpleMemberAccessExpression, - SyntaxFactory.ThisExpression(), - SyntaxFactory.IdentifierName(candidConverterProperty) - ) - ); - // Build arguments for conversion to CandidArg - IEnumerable fromCandidArguments = argTypes - .Select(t => - { - // `CandidTypedValue.FromObject({argX}, this.Converter);` - string argName = this.NameHelper.ToCamelCase(t.Name); - ExpressionSyntax expression = SyntaxFactory.InvocationExpression( - SyntaxFactory.MemberAccessExpression( - SyntaxKind.SimpleMemberAccessExpression, - SyntaxFactory.IdentifierName(typeof(CandidTypedValue).FullName!), - SyntaxFactory.IdentifierName(nameof(CandidTypedValue.FromObject)) - ) - ) - .WithArgumentList( - SyntaxFactory.ArgumentList( - SyntaxFactory.SeparatedList(new[] { - SyntaxFactory.Argument(SyntaxFactory.IdentifierName(argName.ToSyntaxIdentifier())), - converterArg - }) - ) - ); - return SyntaxFactory.Argument(expression); - }); - - // Build candid arg - // `CandidArg arg = CandidArg.FromCandid(arg0, arg1, ...);` - const string argName = "arg"; - VariableDeclarationSyntax argVariable = SyntaxFactory - .VariableDeclaration(SyntaxFactory.IdentifierName(typeof(CandidArg).FullName!)) - .WithVariables( - SyntaxFactory.SingletonSeparatedList( - SyntaxFactory.VariableDeclarator( - SyntaxFactory.Identifier(argName) - ) - .WithInitializer( - SyntaxFactory.EqualsValueClause( - SyntaxFactory.InvocationExpression( - SyntaxFactory.MemberAccessExpression( - SyntaxKind.SimpleMemberAccessExpression, - SyntaxFactory.IdentifierName(typeof(CandidArg).FullName!), - SyntaxFactory.IdentifierName(nameof(CandidArg.FromCandid)) - ) - ) - .WithArgumentList( - SyntaxFactory.ArgumentList( - SyntaxFactory.SeparatedList(fromCandidArguments) - ) - ) - ) - ) - ) - ); - - var statements = new List - { - SyntaxFactory.LocalDeclarationStatement(argVariable), - }; - - const string variableName = "reply"; - if (isOneway) - { - // Fire and forget - // No return args - // Query and Oneway are exclusive annotations in the IC - // `await this.Agent.CallAsync(this.CanisterId, {methodName}, arg)` - StatementSyntax invokeCall = this.GenerateCall(candidName, argName); - statements.Add(invokeCall); - return SyntaxFactory.Block(statements); - } - if (isQuery) - { - const string responseName = "response"; - // `QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, {methodName}, arg);` - StatementSyntax invokeQueryCall = this.GenerateQueryCall(candidName, argName, responseName); - statements.Add(invokeQueryCall); - - // `CandidArg reply = response.ThrowOrGetReply();` - StatementSyntax invokeThrowOrGetReply = this.GenerateThrowOrGetReply(variableName, responseName); - statements.Add(invokeThrowOrGetReply); - - } - else - { - // `CandidArg reply = await this.Agent.CallAsync(this.CanisterId, {methodName}, arg)` - string? replyVariableName = returnTypes.Any() ? variableName : null; // Dont include reply variable if its not used - StatementSyntax invokeCallAndWait = this.GenerateCallAndWait(candidName, argName, replyVariableName); - statements.Add(invokeCallAndWait); - - } - if (returnTypes.Any()) - { - statements.Add( - // `return reply.ToObjects<{T1}, {T2}, ...>(candidConverter);` - SyntaxFactory.ReturnStatement( - SyntaxFactory.InvocationExpression( - SyntaxFactory.MemberAccessExpression( - SyntaxKind.SimpleMemberAccessExpression, - SyntaxFactory.IdentifierName(variableName), - SyntaxFactory.GenericName( - SyntaxFactory.Identifier(nameof(CandidArg.ToObjects)) - ) - .WithTypeArgumentList( - SyntaxFactory.TypeArgumentList( - SyntaxFactory.SeparatedList( - returnTypes - .Select(t => t.Type.ToTypeSyntax(this.FeatureNullable)) - ) - ) - ) - ) - ) - .WithArgumentList( - SyntaxFactory.ArgumentList( - SyntaxFactory.SingletonSeparatedList(converterArg) - ) - ) - ) - ); - } - return SyntaxFactory.Block(statements); - } - - private StatementSyntax GenerateThrowOrGetReply(string variableName, string responseName) - { - return SyntaxFactory.LocalDeclarationStatement( - SyntaxFactory.VariableDeclaration( - SyntaxFactory.IdentifierName(typeof(CandidArg).FullName!) - ) - .WithVariables( - SyntaxFactory.SingletonSeparatedList( - SyntaxFactory.VariableDeclarator( - SyntaxFactory.Identifier(variableName) - ) - .WithInitializer( - SyntaxFactory.EqualsValueClause( - SyntaxFactory.InvocationExpression( - SyntaxFactory.MemberAccessExpression( - SyntaxKind.SimpleMemberAccessExpression, - SyntaxFactory.IdentifierName(responseName), - SyntaxFactory.IdentifierName(nameof(QueryResponse.ThrowOrGetReply)) - ) - ) - ) - ) - ) - ) - ); - } - - private StatementSyntax GenerateQueryCall(string methodName, string argName, string responseName) - { - return SyntaxFactory.LocalDeclarationStatement( - SyntaxFactory.VariableDeclaration( - SyntaxFactory.IdentifierName(typeof(QueryResponse).FullName!) - ) - .WithVariables( - SyntaxFactory.SingletonSeparatedList( - SyntaxFactory.VariableDeclarator( - SyntaxFactory.Identifier(responseName) - ) - .WithInitializer( - SyntaxFactory.EqualsValueClause( - SyntaxFactory.AwaitExpression( - SyntaxFactory.InvocationExpression( - SyntaxFactory.MemberAccessExpression( - SyntaxKind.SimpleMemberAccessExpression, - SyntaxFactory.MemberAccessExpression( - SyntaxKind.SimpleMemberAccessExpression, - SyntaxFactory.ThisExpression(), - SyntaxFactory.IdentifierName("Agent") - ), - SyntaxFactory.IdentifierName(nameof(IAgent.QueryAsync)) - ) - ) - .WithArgumentList( - SyntaxFactory.ArgumentList( - SyntaxFactory.SeparatedList( - new SyntaxNodeOrToken[]{ - SyntaxFactory.Argument( - SyntaxFactory.MemberAccessExpression( - SyntaxKind.SimpleMemberAccessExpression, - SyntaxFactory.ThisExpression(), - SyntaxFactory.IdentifierName("CanisterId") - ) - ), - SyntaxFactory.Token(SyntaxKind.CommaToken), - SyntaxFactory.Argument( - SyntaxFactory.LiteralExpression( - SyntaxKind.StringLiteralExpression, - SyntaxFactory.Literal(methodName) - ) - ), - SyntaxFactory.Token(SyntaxKind.CommaToken), - SyntaxFactory.Argument( - SyntaxFactory.IdentifierName(argName) - ) - } - ) - ) - ) - ) - ) - ) - ) - ) - ); - } - - private StatementSyntax GenerateCallAndWait(string methodName, string argName, string? variableName) - { - InvocationExpressionSyntax apiCall = SyntaxFactory.InvocationExpression( - SyntaxFactory.MemberAccessExpression( - SyntaxKind.SimpleMemberAccessExpression, - SyntaxFactory.MemberAccessExpression( - SyntaxKind.SimpleMemberAccessExpression, - SyntaxFactory.ThisExpression(), - SyntaxFactory.IdentifierName("Agent") - ), - SyntaxFactory.IdentifierName("CallAsync") - ) - ) - .WithArgumentList( - SyntaxFactory.ArgumentList( - SyntaxFactory.SeparatedList( - new SyntaxNodeOrToken[] { - SyntaxFactory.Argument( - SyntaxFactory.MemberAccessExpression( - SyntaxKind.SimpleMemberAccessExpression, - SyntaxFactory.ThisExpression(), - SyntaxFactory.IdentifierName("CanisterId") - ) - ), - SyntaxFactory.Token(SyntaxKind.CommaToken), - SyntaxFactory.Argument( - SyntaxFactory.LiteralExpression( - SyntaxKind.StringLiteralExpression, - SyntaxFactory.Literal(methodName) - ) - ), - SyntaxFactory.Token(SyntaxKind.CommaToken), - SyntaxFactory.Argument( - SyntaxFactory.IdentifierName(argName) - ) - } - ) - ) - ); - if (variableName != null) - { - // `CandidArg reply = await ...` - return SyntaxFactory.LocalDeclarationStatement( - SyntaxFactory.VariableDeclaration( - SyntaxFactory.IdentifierName(typeof(CandidArg).FullName!) - ) - .WithVariables( - SyntaxFactory.SingletonSeparatedList( - SyntaxFactory.VariableDeclarator( - SyntaxFactory.Identifier(variableName) - ) - .WithInitializer( - SyntaxFactory.EqualsValueClause( - SyntaxFactory.AwaitExpression(apiCall) - ) - ) - ) - ) - ); - } - // No variable, just await - // `await ...` - - return SyntaxFactory.ExpressionStatement( - SyntaxFactory.AwaitExpression(apiCall) - ); - } - private StatementSyntax GenerateCall(string methodName, string argName) - { - InvocationExpressionSyntax apiCall = SyntaxFactory.InvocationExpression( - SyntaxFactory.MemberAccessExpression( - SyntaxKind.SimpleMemberAccessExpression, - SyntaxFactory.MemberAccessExpression( - SyntaxKind.SimpleMemberAccessExpression, - SyntaxFactory.ThisExpression(), - SyntaxFactory.IdentifierName("Agent") - ), - SyntaxFactory.IdentifierName("CallAsync") - ) - ) - .WithArgumentList( - SyntaxFactory.ArgumentList( - SyntaxFactory.SeparatedList( - new SyntaxNodeOrToken[] { - SyntaxFactory.Argument( - SyntaxFactory.MemberAccessExpression( - SyntaxKind.SimpleMemberAccessExpression, - SyntaxFactory.ThisExpression(), - SyntaxFactory.IdentifierName("CanisterId") - ) - ), - SyntaxFactory.Token(SyntaxKind.CommaToken), - SyntaxFactory.Argument( - SyntaxFactory.LiteralExpression( - SyntaxKind.StringLiteralExpression, - SyntaxFactory.Literal(methodName) - ) - ), - SyntaxFactory.Token(SyntaxKind.CommaToken), - SyntaxFactory.Argument( - SyntaxFactory.IdentifierName(argName) - ) - } - ) - ) - ); - return SyntaxFactory.ExpressionStatement( - SyntaxFactory.AwaitExpression(apiCall) - ); - } - - private ConstructorDeclarationSyntax GenerateConstructor( - TypeName name, - AccessType access, - List<(string Name, TypeName Type, bool SetValue)> properties, - List<(string Name, TypeName Type, bool SetValue)>? optionalProperties = null - ) - { - optionalProperties ??= new List<(string Name, TypeName Type, bool SetValue)>(); - IEnumerable propertyAssignments = properties.Where(p => p.SetValue) - .Concat(optionalProperties.Where(p => p.SetValue)) - .Select(p => - { - string argName = this.NameHelper.ToCamelCase(p.Name); - var value = SyntaxFactory.IdentifierName(argName); - return SyntaxFactory.ExpressionStatement( - SyntaxFactory.AssignmentExpression( - SyntaxKind.SimpleAssignmentExpression, - SyntaxFactory.MemberAccessExpression( - SyntaxKind.SimpleMemberAccessExpression, - SyntaxFactory.ThisExpression(), - SyntaxFactory.IdentifierName(p.Name) - ), - value - ) - ); - }); - - BlockSyntax body = SyntaxFactory.Block(propertyAssignments); - - - ConstructorDeclarationSyntax constructor = SyntaxFactory - .ConstructorDeclaration( - SyntaxFactory.Identifier(name.BuildName(this.FeatureNullable, false)) - ) - .WithParameterList( - SyntaxFactory.ParameterList( - SyntaxFactory.SeparatedList( - properties - .Select(p => - { - string argName = this.NameHelper.ToCamelCase(p.Name); - return SyntaxFactory.Parameter( - SyntaxFactory.Identifier(argName) - ) - .WithType(p.Type!.ToTypeSyntax(this.FeatureNullable)); - }) - .Concat(optionalProperties - .Select(p => - { - string argName = this.NameHelper.ToCamelCase(p.Name); - return SyntaxFactory.Parameter( - SyntaxFactory.Identifier(argName) - ) - .WithType(p.Type!.ToTypeSyntax(this.FeatureNullable)) - // Add `= default` to the end - .WithDefault(SyntaxFactory.EqualsValueClause( - SyntaxFactory.LiteralExpression( - SyntaxKind.DefaultLiteralExpression) - ) - ); - })) - ) - ) - ) - .WithBody(body); - - // Add access (public, private, ...) - SyntaxToken? accessSyntaxToken = this.GenerateAccessToken(access); - if (accessSyntaxToken != null) - { - constructor = constructor - .WithModifiers( - SyntaxFactory.TokenList(accessSyntaxToken.Value) - ); - } - - return constructor; - } - - private SyntaxToken? GenerateAccessToken(AccessType access) - { - SyntaxKind? accessKeyword = access switch - { - AccessType.None => null, - AccessType.Public => SyntaxKind.PublicKeyword, - AccessType.Private => SyntaxKind.PrivateKeyword, - AccessType.Protected => SyntaxKind.ProtectedKeyword, - _ => throw new NotImplementedException(), - }; - return accessKeyword == null ? null : SyntaxFactory.Token(accessKeyword.Value); - } - - private MethodDeclarationSyntax GenerateMethod( - BlockSyntax body, - AccessType access, - bool isStatic, - bool isAsync, - List? returnTypes, - string name, - List? attributes, - params (TypeName Type, string Name)[] parameters) - { - TypeSyntax? returnType = null; - if (returnTypes?.Any() == true) - { - if (returnTypes.Count == 1) - { - // Single return type - returnType = returnTypes[0].Type.ToTypeSyntax(this.FeatureNullable); - } - else - { - // Tuple of return types - returnType = SyntaxFactory.TupleType(SyntaxFactory.SeparatedList( - returnTypes - .Where(t => t != null) - .Select(t => SyntaxFactory.TupleElement(t.Type.ToTypeSyntax(this.FeatureNullable), (" " + t.Value.Name).ToSyntaxIdentifier())) - )); - } - } - - if (returnType == null) - { - if (isAsync) - { - // `Task` return type - returnType = SyntaxFactory.IdentifierName(typeof(Task).FullName!.ToSyntaxIdentifier()); - } - else - { - // `void` return type - returnType = SyntaxFactory.PredefinedType(SyntaxFactory.Token(SyntaxKind.VoidKeyword)); - } - } - else - { - if (isAsync) - { - // Wrap return type in Task. `Task<{returnType}>` - returnType = SyntaxFactory.GenericName(typeof(Task).FullName!.ToSyntaxIdentifier()) - .WithTypeArgumentList( - SyntaxFactory.TypeArgumentList( - SyntaxFactory.SingletonSeparatedList( - returnType - ) - ) - ); - } - } - - - List methodModifiers = new(); - - SyntaxToken? methodAccess = access switch - { - AccessType.None => null, - AccessType.Public => SyntaxFactory.Token(SyntaxKind.PublicKeyword), - AccessType.Private => SyntaxFactory.Token(SyntaxKind.PrivateKeyword), - AccessType.Protected => SyntaxFactory.Token(SyntaxKind.PropertyKeyword), - _ => throw new NotImplementedException(), - }; - - if (methodAccess != null) - { - methodModifiers.Add(methodAccess.Value); - } - - if (isAsync) - { - // Add `async` keyword to method modifiers - methodModifiers.Add(SyntaxFactory.Token(SyntaxKind.AsyncKeyword)); - } - if (isStatic) - { - // Add `static` keyword to method modifiers - methodModifiers.Add(SyntaxFactory.Token(SyntaxKind.StaticKeyword)); - } - - IEnumerable @params = parameters - .Select(p => - { - return SyntaxFactory - .Parameter(p.Name.ToSyntaxIdentifier()) - .WithType(p.Type.ToTypeSyntax(this.FeatureNullable)); - }); - var method = SyntaxFactory.MethodDeclaration(returnType, SyntaxFactory.Identifier(name)) - .WithModifiers(SyntaxFactory.TokenList(methodModifiers)) - .WithParameterList(SyntaxFactory.ParameterList(SyntaxFactory.SeparatedList(@params))) - .WithBody(body); - if (attributes?.Any() == true) - { - IEnumerable attributeSyntaxList = attributes - .Select(this.GenerateAttribute); - method = method.WithAttributeLists(SyntaxFactory.List(attributeSyntaxList)); - } - return method; - } - - private ClassDeclarationSyntax GenerateClass( - TypeName name, - List properties, - List? optionalProperties = null, - List? methods = null, - List? customProperties = null, - List? implementTypes = null, - List? attributes = null, - AccessType? emptyConstructorAccess = null, - List? subTypes = null) - { - if (properties.Any(p => p.Type == null)) - { - // TODO - throw new NotImplementedException("Null, empty or reserved properties are not yet supported"); - } - var uniquePropertyNames = new HashSet(); - ClassProperty FixDuplicates(ClassProperty property) - { - string name = property.Name; - int i = 0; - while (!uniquePropertyNames.Add(name)) - { - // Add number suffix till there are no duplicates - i++; - name = property.Name + i.ToString(); - } - if (i > 0) - { - return new ClassProperty(name, property.Type, property.Access, property.HasSetter, property.Attributes); - } - return property; - } - properties = properties - .Select(FixDuplicates) // Fix if there are duplicate names - .ToList(); - optionalProperties = optionalProperties - ?.Select(FixDuplicates) // Fix if there are duplicate names - .ToList(); - List constructors = new(); - IEnumerable properySyntaxList = properties - .Concat(optionalProperties ?? new List()) - .Select(this.GenerateProperty) - .Where(p => p != null)!; - if (customProperties != null) - { - properySyntaxList = properySyntaxList.Concat(customProperties); - } - if (properties.Any()) - { - // Only create constructor if there are properties - List<(string Name, TypeName Type, bool SetValue)> constructorProps = properties - .Where(p => p.Type != null) - .Select(p => (p.Name, p.Type!, true)) - .ToList(); - List<(string Name, TypeName Type, bool SetValue)>? constructorOptProps = optionalProperties? - .Where(p => p.Type != null) - .Select(p => (p.Name, p.Type!, true)) - .ToList(); - constructors.Add(this.GenerateConstructor(name, AccessType.Public, constructorProps, constructorOptProps)); - } - - if (emptyConstructorAccess != null) - { - // Empty Constrcutor for reflection - constructors.Add(this.GenerateConstructor( - name: name, - access: emptyConstructorAccess.Value, - properties: new List<(string Name, TypeName Type, bool SetValue)>() - )); - } - - ClassDeclarationSyntax classSyntax = SyntaxFactory.ClassDeclaration(name.BuildName(this.FeatureNullable, false)) - .WithModifiers(SyntaxFactory.TokenList( - // Make class public - SyntaxFactory.Token(SyntaxKind.PublicKeyword) - )) - .WithMembers(SyntaxFactory.List( - // Properties - properySyntaxList.Cast() - // Constructors - .Concat(constructors.Cast()) - // Methods - .Concat(methods?.Cast() ?? Array.Empty()) - // Subtypes - .Concat(subTypes?.Cast() ?? Array.Empty()) - )); - - - if (implementTypes?.Any() == true) - { - classSyntax = classSyntax - .WithBaseList( - SyntaxFactory.BaseList( - SyntaxFactory.SeparatedList( - implementTypes - .Select(t => SyntaxFactory.SimpleBaseType(t.ToTypeSyntax(this.FeatureNullable))) - .Cast() - .ToArray() - ) - ) - ); - } - if (attributes?.Any() == true) - { - classSyntax = classSyntax - .WithAttributeLists( - SyntaxFactory.List(attributes) - ); - } - return classSyntax; - - } - - private enum AccessType - { - None, - Public, - Private, - Protected - } - - private class ClassProperty - { - public AccessType Access { get; } - public string Name { get; } - public TypeName? Type { get; } - public bool IsNullable { get; } - public bool HasSetter { get; } - public AttributeInfo[]? Attributes { get; } - - public ClassProperty( - string name, - TypeName? type, - AccessType access, - bool hasSetter, - params AttributeInfo[]? attributes - ) - { - this.Access = access; - this.Name = name ?? throw new ArgumentNullException(nameof(name)); - this.Type = type; - this.HasSetter = hasSetter; - this.Attributes = attributes; - } - - - } - - } -} +using EdjCase.ICP.ClientGenerator; +using Microsoft.CodeAnalysis.CSharp; +using Microsoft.CodeAnalysis; +using Microsoft.CodeAnalysis.CSharp.Syntax; +using System; +using System.Collections.Generic; +using System.Linq; +using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models.Values; +using System.Threading.Tasks; +using EdjCase.ICP.Candid; +using Org.BouncyCastle.Asn1.Cms; +using EdjCase.ICP.Candid.Models.Types; + +namespace EdjCase.ICP.ClientGenerator +{ + internal class RoslynTypeResolver + { + private readonly Dictionary _resolvedTypes = new(); + + public string ModelNamespace { get; } + public HashSet Aliases { get; } + public bool FeatureNullable { get; } + public bool VariantsUseProperties { get; } + public NameHelper NameHelper { get; } + public Dictionary DeclaredTypes { get; } + + public RoslynTypeResolver( + string modelNamespace, + HashSet aliases, + bool featureNullable, + bool variantsUseProperties, + NameHelper nameHelper, + Dictionary declaredTypes + ) + { + this.ModelNamespace = modelNamespace; + this.Aliases = aliases; + this.FeatureNullable = featureNullable; + this.VariantsUseProperties = variantsUseProperties; + this.NameHelper = nameHelper; + this.DeclaredTypes = declaredTypes; + } + + public ResolvedType ResolveTypeDeclaration( + string typeId, + string typeName, + SourceCodeType type + ) + { + // note that this only works for only one level of type nesting, so type aliases to generics whose argument is a user-defined type + // will fail, for example: + // type A = record { left : A, right : B }; + // type X = blob; + // type F = A; + + + if (this._resolvedTypes.TryGetValue(typeId, out ResolvedType? existing)) + { + return existing; + } + Stack parentTypeIds = new Stack(); + parentTypeIds.Push(typeId); + ResolvedType res = this.ResolveType(type, typeName, parentType: null, parentTypeIds); + this._resolvedTypes[typeId] = res; + return res; + } + + private ResolvedType ResolveType( + SourceCodeType type, + string nameContext, + TypeName? parentType, + Stack parentTypeIds + ) + { + switch (type) + { + case RawCandidType t: + { + CandidTypeTypeName typeName = new(t.CandidType); + return new ResolvedType(typeName); + } + case NonGenericSourceCodeType c: + { + var cType = new SimpleTypeName( + c.Type.Name, + c.Type.Namespace, + isDefaultNullable: c.Type.IsClass + ); + return new ResolvedType(cType); + } + case ListSourceCodeType l: + { + if (l.IsPredefinedType) + { + ResolvedType resolvedGenericType = this.ResolveType(l.ElementType, nameContext + "Item", parentType, parentTypeIds); + + var name = new ListTypeName(resolvedGenericType.Name); + return new ResolvedType(name, resolvedGenericType.GeneratedSyntax); + } + else + { + TypeName listName = this.BuildType(nameContext, parentType, isDefaultNullable: true); + ClassDeclarationSyntax syntax = this.GenerateList(listName, l, parentTypeIds); + return new ResolvedType(listName, new MemberDeclarationSyntax[] { syntax }); + } + } + case DictionarySourceCodeType d: + { + if (d.IsPredefinedType) + { + ResolvedType resolvedKeyType = this.ResolveType(d.KeyType, nameContext + "Key", parentType, parentTypeIds); + ResolvedType resolvedValueType = this.ResolveType(d.ValueType, nameContext + "Value", parentType, parentTypeIds); + MemberDeclarationSyntax[] generatedSyntax = (resolvedKeyType.GeneratedSyntax ?? Array.Empty()) + .Concat(resolvedValueType.GeneratedSyntax ?? Array.Empty()) + .ToArray(); ; + var name = new DictionaryTypeName(resolvedKeyType.Name, resolvedValueType.Name); + return new ResolvedType(name, generatedSyntax); + } + else + { + TypeName dictName = this.BuildType(nameContext, parentType, isDefaultNullable: true); + ClassDeclarationSyntax syntax = this.GenerateDictionary(dictName, d, parentTypeIds); + return new ResolvedType(dictName, new MemberDeclarationSyntax[] { syntax }); + } + } + case TupleSourceCodeType t: + { + List resolvedGenericTypes = t.Fields + .Select((f, i) => this.ResolveType(f, nameContext + "Value_" + i, parentType, parentTypeIds)) + .ToList(); + List elementTypeNames = resolvedGenericTypes + .Select(f => f.Name) + .ToList(); + MemberDeclarationSyntax[] generatedSyntax = resolvedGenericTypes + .SelectMany(t => t.GeneratedSyntax ?? Array.Empty()) + .ToArray(); + var name = new TupleTypeName(elementTypeNames); + return new ResolvedType(name, generatedSyntax); + } + case OptionalValueSourceCodeType v: + { + TypeName name; + if (v.IsPredefinedType) + { + ResolvedType resolvedGenericType = this.ResolveType(v.GenericType, nameContext + "Value", parentType, parentTypeIds); + name = new OptionalValueTypeName(resolvedGenericType.Name); + return new ResolvedType(name, resolvedGenericType.GeneratedSyntax); + } + else + { + TypeName oValueName = this.BuildType(nameContext, parentType, isDefaultNullable: true); + ClassDeclarationSyntax syntax = this.GenerateOptionalValue(oValueName, v, parentTypeIds); + return new ResolvedType(oValueName, new MemberDeclarationSyntax[] { syntax }); + } + } + case ArraySourceCodeType a: + { + if (a.ElementType == null) + { + return new ResolvedType(new ArrayTypeName(null)); + } + ResolvedType resolvedGenericType = this.ResolveType(a.ElementType, nameContext + "Item", parentType, parentTypeIds); + + var name = new ArrayTypeName(resolvedGenericType.Name); + return new ResolvedType(name, resolvedGenericType.GeneratedSyntax); + } + case ReferenceSourceCodeType re: + { + bool isAlias = this.Aliases.Contains(re.Id.Value); + (string name, SourceCodeType sourceCodeType) = this.DeclaredTypes[re.Id.Value]; + + string? @namespace = isAlias ? null : this.ModelNamespace; + TypeName typeName = new SimpleTypeName( + name, + @namespace, + true // TODO + ); + return new ResolvedType(typeName); + + } + case VariantSourceCodeType v: + { + TypeName variantName = this.BuildType(nameContext, parentType, isDefaultNullable: true); + (ClassDeclarationSyntax? ClassSyntax, EnumDeclarationSyntax EnumSyntax) result = this.GenerateVariant(variantName, v, parentType, parentTypeIds); + if (result.ClassSyntax != null) + { + return new ResolvedType(variantName, new MemberDeclarationSyntax[] { result.ClassSyntax, result.EnumSyntax }); + } + return new ResolvedType(variantName, new MemberDeclarationSyntax[] { result.EnumSyntax }); + } + case RecordSourceCodeType r: + { + TypeName recordName = this.BuildType(nameContext, parentType, isDefaultNullable: true); + ClassDeclarationSyntax classSyntax = this.GenerateRecord(recordName, r, parentTypeIds); + return new ResolvedType(recordName, new MemberDeclarationSyntax[] { classSyntax }); + } + default: + throw new NotImplementedException(); + } + } + + + public ClassDeclarationSyntax GenerateClient( + TypeName clientName, + ServiceSourceCodeType service) + { + string candidConverterProperty = "Converter"; + List properties = new() + { + // public IAgent Agent { get; } + new ClassProperty( + name: "Agent", + type: SimpleTypeName.FromType(), + access: AccessType.Public, + hasSetter: false + ), + + // public Principal CanisterId { get; } + new ClassProperty( + name: "CanisterId", + type: SimpleTypeName.FromType(), + access: AccessType.Public, + hasSetter: false + ), + }; + + List optionalProperties = new() + { + // public CandidConverter? Converter { get; } + new ClassProperty( + name: candidConverterProperty, + type: SimpleTypeName.FromType(isNullable: this.FeatureNullable), + access: AccessType.Public, + hasSetter: false + ) + }; + + Stack parentTypeIds = new(); + List<(MethodDeclarationSyntax Method, List SubTypes)> methods = service.Methods + .Select(method => this.GenerateFuncMethod(method.CsharpName, method.CandidName, method.FuncInfo, clientName, this, candidConverterProperty, parentTypeIds)) + .ToList(); + + return this.GenerateClass( + clientName, + properties, + optionalProperties: optionalProperties, + methods: methods.Select(m => m.Method).ToList(), + subTypes: methods.SelectMany(m => m.SubTypes).ToList() + ); + } + + internal ClassDeclarationSyntax GenerateOptionalValue( + TypeName oValueName, + OptionalValueSourceCodeType v, + Stack parentTypeIds + ) + { + string parentName = oValueName.BuildName(this.FeatureNullable, false, true); + ResolvedType resolvedGenericType = this.ResolveType(v.GenericType, parentName + "Value", oValueName, parentTypeIds); + List properties = new(); + List methods = new(); + + var constructorProps = new List<(string Name, TypeName Type, bool SetValue)> + { + ("value", resolvedGenericType.Name, false) + }; + var constructor = this.GenerateConstructor(oValueName, AccessType.Public, constructorProps) + .WithInitializer(SyntaxFactory.ConstructorInitializer( + SyntaxKind.BaseConstructorInitializer, + SyntaxFactory.ArgumentList( + SyntaxFactory.SingletonSeparatedList( + SyntaxFactory.Argument( + SyntaxFactory.IdentifierName("value") + ) + ) + ) + )); + List subTypes = new() + { + constructor + }; + if (resolvedGenericType.GeneratedSyntax?.Any() == true) + { + subTypes.AddRange(resolvedGenericType.GeneratedSyntax); + } + return this.GenerateClass( + name: oValueName, + properties: properties, + optionalProperties: null, + customProperties: null, + methods: methods, + attributes: null, + emptyConstructorAccess: AccessType.Public, + subTypes: subTypes, + implementTypes: new List + { + new OptionalValueTypeName(resolvedGenericType.Name) + } + ); + } + + internal ClassDeclarationSyntax GenerateList( + TypeName listName, + ListSourceCodeType type, + Stack parentTypeIds + ) + { + string parentName = listName.BuildName(this.FeatureNullable, false, true); + ResolvedType elementType = this.ResolveType(type.ElementType, parentName + "Element", listName, parentTypeIds); + + List properties = new(); + List methods = new(); + return this.GenerateClass( + name: listName, + properties: properties, + optionalProperties: null, + customProperties: null, + methods: methods, + attributes: null, + emptyConstructorAccess: AccessType.Public, + subTypes: elementType.GeneratedSyntax?.ToList(), + implementTypes: new List + { + new ListTypeName(elementType.Name) + } + ); + } + + internal ClassDeclarationSyntax GenerateDictionary( + TypeName dictName, + DictionarySourceCodeType type, + Stack parentTypeIds + ) + { + string parentName = dictName.BuildName(this.FeatureNullable, false, true); + ResolvedType keyType = this.ResolveType(type.KeyType, parentName + "Key", dictName, parentTypeIds); + ResolvedType valueType = this.ResolveType(type.ValueType, parentName + "Value", dictName, parentTypeIds); + + List properties = new(); + List methods = new(); + List subTypes = new(); + if (keyType.GeneratedSyntax != null) + { + subTypes.AddRange(keyType.GeneratedSyntax); + } + if (valueType.GeneratedSyntax != null) + { + subTypes.AddRange(valueType.GeneratedSyntax); + } + return this.GenerateClass( + name: dictName, + properties: properties, + optionalProperties: null, + customProperties: null, + methods: methods, + attributes: null, + emptyConstructorAccess: AccessType.Public, + subTypes: subTypes, + implementTypes: new List + { + new DictionaryTypeName(keyType.Name, valueType.Name) + } + ); + } + + + internal (ClassDeclarationSyntax? Class, EnumDeclarationSyntax Type) GenerateVariant( + TypeName variantTypeName, + VariantSourceCodeType variant, + TypeName? parentType, + Stack parentTypeIds + ) + { + (ResolvedName Name, ResolvedType? Type, bool OptionalOverridden) ResolveOption(VariantSourceCodeType.VariantOption option, int i) + { + ResolvedType? resolvedType; + if (option.Type == null) + { + resolvedType = null; + } + else + { + string nameContext = option.Type.IsPredefinedType + ? option.Tag.Name + : option.Tag.Name + "Info"; // If need to generate sub type, add suffix to avoid name collision + resolvedType = this.ResolveType(option.Type, nameContext, variantTypeName, parentTypeIds); + } + return (option.Tag, resolvedType, option.OptionalOverridden); + } + + + List<(ResolvedName Name, ResolvedType? Type, bool OptionalOverridden)> resolvedOptions = variant.Options + .Select(ResolveOption) + .ToList(); + + List<(ResolvedName Name, TypeName? Type)> enumOptions = resolvedOptions + .Select(o => (o.Name, o.Type?.Name)) + .ToList(); + + if (enumOptions.All(o => o.Type == null)) + { + // If there are no types, just create an enum value + + TypeName enumTypeName = this.BuildType(variantTypeName.BuildName(this.FeatureNullable, false), parentType, isDefaultNullable: false); + EnumDeclarationSyntax enumSyntax = this.GenerateEnum(enumTypeName, enumOptions); + return (null, enumSyntax); + } + else + { + TypeName enumTypeName = this.BuildType(variantTypeName.BuildName(this.FeatureNullable, false) + "Tag", parentType, isDefaultNullable: false); + + // TODO auto change the property values of all class types if it matches the name + bool containsClashingTag = variantTypeName.BuildName(this.FeatureNullable, false) == "Tag" + || variant.Options.Any(o => o.Tag.Name == "Tag"); + string tagName = containsClashingTag ? "Tag_" : "Tag"; + + bool containsClashingValue = variantTypeName.BuildName(this.FeatureNullable, false) == "Value" + || variant.Options.Any(o => o.Tag.Name == "Value"); + string valueName = containsClashingValue ? "Value_" : "Value"; + + List properties = new() + { + new ClassProperty( + tagName, + enumTypeName, + access: AccessType.Public, + hasSetter: true, + AttributeInfo.FromType() + ), + new ClassProperty( + valueName, + SimpleTypeName.FromType(isNullable: this.FeatureNullable), + access: AccessType.Public, + hasSetter: true, + AttributeInfo.FromType() + ) + }; + List methods; + List? customProperties; + if (!this.VariantsUseProperties) + { + methods = this.GenerateVariantMethods( + variantTypeName, + enumTypeName, + valueName, + tagName, + resolvedOptions + ); + customProperties = null; + } + else + { + methods = new List(); + + customProperties = this.GenerateVariantProperties( + variantTypeName, + enumTypeName, + valueName, + tagName, + resolvedOptions + ); + } + + List attributes = new() + { + // [Variant] + this.GenerateAttribute(AttributeInfo.FromType()) + }; + ClassDeclarationSyntax classSyntax = this.GenerateClass( + name: variantTypeName, + properties: properties, + optionalProperties: null, + customProperties: customProperties, + methods: methods, + attributes: attributes, + emptyConstructorAccess: AccessType.Protected, + subTypes: resolvedOptions + .SelectMany(o => o.Type?.GeneratedSyntax ?? Array.Empty()) + .ToList() + ); + EnumDeclarationSyntax enumSyntax = this.GenerateEnum(enumTypeName, enumOptions); + return (classSyntax, enumSyntax); + } + } + + private List GenerateVariantProperties( + TypeName variantTypeName, + TypeName enumTypeName, + string valueName, + string tagName, + List<(ResolvedName Name, ResolvedType? Type, bool OptionalOverridden)> resolvedOptions + ) + { + // Properties with types + // public {OptionType}? {OptionName} { + // get => this.Tag == {EnumName}.{OptionName} ? ({OptionType})this.Value : default; + // set => (this.Tag, this.Value) = ({EnumName}.{OptionName}, value); + // } + return resolvedOptions + .Where(o => o.Type != null) + .Select(o => + { + List attributeSyntaxList = new(); + if (o.OptionalOverridden) + { + attributeSyntaxList.Add(this.GenerateAttribute(AttributeInfo.FromType())); + } + CandidType? candidType = o.Type!.Name.GetCandidType(); + if (candidType != null) + { + // [CandidTypeDefinition("{typeDefinition}")] + string candidTypeDefinition = CandidTextGenerator.Generate(candidType, indentType: CandidTextGenerator.IndentType.None); + attributeSyntaxList.Add(this.GenerateAttribute(AttributeInfo.FromType(candidTypeDefinition))); + } + + List accessors = new() + { + // Add getter + SyntaxFactory + .AccessorDeclaration(SyntaxKind.GetAccessorDeclaration) + .WithExpressionBody(SyntaxFactory.ArrowExpressionClause( + SyntaxFactory.ConditionalExpression( + // this.Tag == {EnumName}.{OptionName} + SyntaxFactory.BinaryExpression( + SyntaxKind.EqualsExpression, + SyntaxFactory.MemberAccessExpression( + SyntaxKind.SimpleMemberAccessExpression, + SyntaxFactory.ThisExpression(), + SyntaxFactory.IdentifierName(tagName) + ), + SyntaxFactory.MemberAccessExpression( + SyntaxKind.SimpleMemberAccessExpression, + enumTypeName.ToTypeSyntax(this.FeatureNullable), + SyntaxFactory.IdentifierName(o.Name.Name) + ) + ), + // ({OptionType}) this.Value! + SyntaxFactory.CastExpression( + o.Type!.Name.ToTypeSyntax(this.FeatureNullable), + SyntaxFactory.PostfixUnaryExpression( + SyntaxKind.SuppressNullableWarningExpression, + SyntaxFactory.MemberAccessExpression( + SyntaxKind.SimpleMemberAccessExpression, + SyntaxFactory.ThisExpression(), + SyntaxFactory.IdentifierName(valueName) + ) + ) + + ), + // default + SyntaxFactory.LiteralExpression( + SyntaxKind.DefaultLiteralExpression, + SyntaxFactory.Token(SyntaxKind.DefaultKeyword) + ) + ) + )) + .WithSemicolonToken( + SyntaxFactory.Token(SyntaxKind.SemicolonToken) + ), + // Add setter + SyntaxFactory + .AccessorDeclaration(SyntaxKind.SetAccessorDeclaration) + .WithExpressionBody(SyntaxFactory.ArrowExpressionClause( + SyntaxFactory.AssignmentExpression( + SyntaxKind.SimpleAssignmentExpression, + SyntaxFactory.TupleExpression( + SyntaxFactory.SeparatedList( + new SyntaxNodeOrToken[]{ + SyntaxFactory.Argument( + SyntaxFactory.MemberAccessExpression( + SyntaxKind.SimpleMemberAccessExpression, + SyntaxFactory.ThisExpression(), + SyntaxFactory.IdentifierName(tagName) + ) + ), + SyntaxFactory.Token(SyntaxKind.CommaToken), + SyntaxFactory.Argument( + SyntaxFactory.MemberAccessExpression( + SyntaxKind.SimpleMemberAccessExpression, + SyntaxFactory.ThisExpression(), + SyntaxFactory.IdentifierName(valueName) + ) + ) + } + ) + ), + SyntaxFactory.TupleExpression( + SyntaxFactory.SeparatedList( + new SyntaxNodeOrToken[]{ + SyntaxFactory.Argument( + SyntaxFactory.MemberAccessExpression( + SyntaxKind.SimpleMemberAccessExpression, + enumTypeName.ToTypeSyntax(this.FeatureNullable), + SyntaxFactory.IdentifierName(o.Name.Name) + ) + ), + SyntaxFactory.Token(SyntaxKind.CommaToken), + SyntaxFactory.Argument( + SyntaxFactory.IdentifierName("value") + ) + } + ) + ) + ) + )) + .WithSemicolonToken( + SyntaxFactory.Token(SyntaxKind.SemicolonToken) + ) + }; + TypeName fixedTypeName = new NullableTypeName(o.Type.Name); + return SyntaxFactory.PropertyDeclaration( + fixedTypeName.ToTypeSyntax(this.FeatureNullable), + o.Name.Name + ) + .WithModifiers( + SyntaxFactory.TokenList( + SyntaxFactory.Token(SyntaxKind.PublicKeyword) + ) + ) + .WithAccessorList(SyntaxFactory.AccessorList( + SyntaxFactory.List(accessors) + )) + .WithAttributeLists(SyntaxFactory.List(attributeSyntaxList)); + }) + .ToList(); + + } + + private List GenerateVariantMethods( + TypeName variantTypeName, + TypeName enumTypeName, + string valueName, + string tagName, + List<(ResolvedName Name, ResolvedType? Type, bool OptionalOverridden)> resolvedOptions + ) + { + // Creation methods + // public static {VariantType} {OptionName}({VariantOptionType} value) + // or if there is no type: + // public static {VariantType} {OptionName}() + List methods = resolvedOptions + .Select(o => this.GenerateVariantOptionCreationMethod( + variantTypeName, + enumTypeName, + o.Name, + o.Type, + "info", + o.OptionalOverridden + )) + .ToList(); + + + // 'As{X}' methods (if has option type) + methods.AddRange( + resolvedOptions + .Where(r => r.Type != null) + .Select(o => this.GenerateVariantOptionAsMethod(enumTypeName, o.Name, o.Type!, valueName, o.OptionalOverridden)) + ); + + + bool anyOptionsWithType = resolvedOptions.Any(o => o.Type != null); + if (anyOptionsWithType) + { + // If there are any types, then create the helper method 'ValidateType' that + // they all use + methods.Add(this.GenerateVariantValidateTypeMethod(enumTypeName, tagName)); + } + return methods; + } + + private TypeName BuildType(string name, TypeName? parentType, bool isDefaultNullable) + { + string @namespace; + if (parentType == null) + { + @namespace = this.ModelNamespace; + return new SimpleTypeName(name, @namespace, isDefaultNullable); + } + return new NestedTypeName(parentType, name); + } + + private MethodDeclarationSyntax GenerateVariantValidateTypeMethod( + TypeName enumTypeName, + string tagName + ) + { + // Generate helper function to validate the variant 'As_' methods + //private void ValidateTag({VariantEnum} tag) + //{ + // if (!this.Tag.Equals(tag)) + // { + // throw new InvalidOperationException($"Cannot cast '{this.Tag}' to type '{tag}'"); + // } + //} + string argName = this.NameHelper.ToCamelCase(tagName); + BlockSyntax body = SyntaxFactory.Block( + SyntaxFactory.IfStatement( + SyntaxFactory.PrefixUnaryExpression( + SyntaxKind.LogicalNotExpression, + SyntaxFactory.InvocationExpression( + SyntaxFactory.MemberAccessExpression( + SyntaxKind.SimpleMemberAccessExpression, + SyntaxFactory.MemberAccessExpression( + SyntaxKind.SimpleMemberAccessExpression, + SyntaxFactory.ThisExpression(), + SyntaxFactory.IdentifierName(tagName) + ), + SyntaxFactory.IdentifierName(nameof(CandidTag.Equals)) + ) + ) + .WithArgumentList( + SyntaxFactory.ArgumentList( + SyntaxFactory.SingletonSeparatedList( + SyntaxFactory.Argument( + SyntaxFactory.IdentifierName(argName) + ) + ) + ) + ) + ), + SyntaxFactory.Block( + SyntaxFactory.SingletonList( + SyntaxFactory.ThrowStatement( + SyntaxFactory.ObjectCreationExpression( + SyntaxFactory.IdentifierName(typeof(InvalidOperationException).FullName!) + ) + .WithArgumentList( + SyntaxFactory.ArgumentList( + SyntaxFactory.SingletonSeparatedList( + SyntaxFactory.Argument( + SyntaxFactory.InterpolatedStringExpression( + SyntaxFactory.Token(SyntaxKind.InterpolatedStringStartToken) + ) + .WithContents( + SyntaxFactory.List( + new InterpolatedStringContentSyntax[]{ + SyntaxFactory.InterpolatedStringText() + .WithTextToken( + SyntaxFactory.Token( + SyntaxFactory.TriviaList(), + SyntaxKind.InterpolatedStringTextToken, + "Cannot cast '", + "Cannot cast '", + SyntaxFactory.TriviaList() + ) + ), + SyntaxFactory.Interpolation( + SyntaxFactory.MemberAccessExpression( + SyntaxKind.SimpleMemberAccessExpression, + SyntaxFactory.ThisExpression(), + SyntaxFactory.IdentifierName(tagName) + ) + ), + SyntaxFactory.InterpolatedStringText() + .WithTextToken( + SyntaxFactory.Token( + SyntaxFactory.TriviaList(), + SyntaxKind.InterpolatedStringTextToken, + "' to type '", + "' to type '", + SyntaxFactory.TriviaList() + ) + ), + SyntaxFactory.Interpolation( + SyntaxFactory.IdentifierName(argName) + ), + SyntaxFactory.InterpolatedStringText() + .WithTextToken( + SyntaxFactory.Token( + SyntaxFactory.TriviaList(), + SyntaxKind.InterpolatedStringTextToken, + "'", + "'", + SyntaxFactory.TriviaList() + ) + ) + } + ) + ) + ) + ) + ) + ) + ) + ) + ) + )); + return this.GenerateMethod( + body: body, + access: AccessType.Private, + isStatic: false, + isAsync: false, + returnTypes: null, + name: "ValidateTag", + attributes: null, + (enumTypeName, "tag") + ); + } + + private MethodDeclarationSyntax GenerateVariantOptionAsMethod( + TypeName enumType, + ResolvedName optionName, + ResolvedType optionType, + string valueName, + bool optionalOverridden + ) + { + // public {VariantOptionType} As{OptionName}() + // { + // this.ValidateTag({EnumType}.{Option}); + // return ({VariantOptionType})this.Value!; + // } + BlockSyntax body = SyntaxFactory.Block( + SyntaxFactory.ExpressionStatement( + SyntaxFactory.InvocationExpression( + SyntaxFactory.MemberAccessExpression( + SyntaxKind.SimpleMemberAccessExpression, + SyntaxFactory.ThisExpression(), + SyntaxFactory.IdentifierName("ValidateTag") + ) + ) + .WithArgumentList( + SyntaxFactory.ArgumentList( + SyntaxFactory.SingletonSeparatedList( + SyntaxFactory.Argument( + SyntaxFactory.MemberAccessExpression( + SyntaxKind.SimpleMemberAccessExpression, + enumType.ToTypeSyntax(this.FeatureNullable), + SyntaxFactory.IdentifierName(optionName.Name) + ) + ) + ) + ) + ) + ), + SyntaxFactory.ReturnStatement( + SyntaxFactory.CastExpression( + optionType.Name.ToTypeSyntax(this.FeatureNullable), + SyntaxFactory.PostfixUnaryExpression( + SyntaxKind.SuppressNullableWarningExpression, + SyntaxFactory.MemberAccessExpression( + SyntaxKind.SimpleMemberAccessExpression, + SyntaxFactory.ThisExpression(), + SyntaxFactory.IdentifierName(valueName) + ) + ) + ) + ) + ); + TypeName returnTypeName = optionType.Name; + List? attributes = null; + if (optionalOverridden) + { + // [CandidOptional] + attributes = new List + { + AttributeInfo.FromType() + }; + // Add '?' if applicible + returnTypeName = new NullableTypeName(returnTypeName); + } + CandidType? candidType = returnTypeName.GetCandidType(); + if (candidType != null) + { + // [CandidTypeDefinition("{typeDefinition}")] + attributes ??= new List(); + string candidTypeDefinition = CandidTextGenerator.Generate(candidType, indentType: CandidTextGenerator.IndentType.None); + attributes.Add(AttributeInfo.FromType(candidTypeDefinition)); + } + + return this.GenerateMethod( + body: body, + access: AccessType.Public, + isStatic: false, + isAsync: false, + returnTypes: new List { new TypedValueName(returnTypeName, optionName) }, + name: "As" + optionName.Name, + attributes: attributes + ); + } + + private MethodDeclarationSyntax GenerateVariantOptionCreationMethod( + TypeName variantTypeName, + TypeName enumTypeName, + ResolvedName optionTypeName, + ResolvedType? optionType, + string optionValueParamName, + bool optionalOverridden + ) + { + ExpressionSyntax arg = optionType == null + // If option type is not specified, then use `null` + ? SyntaxFactory.LiteralExpression(SyntaxKind.NullLiteralExpression) + // If option type is specified, then use param + : SyntaxFactory.IdentifierName(optionValueParamName); + + var creationParameters = new List<(TypeName, string)>(); + if (optionType != null) + { + TypeName t = optionType.Name; + if (optionalOverridden) + { + // Add '?' if applicible + t = new NullableTypeName(t); + } + creationParameters.Add((t, optionValueParamName)); + } + string methodName = optionTypeName.Name == variantTypeName.BuildName(this.FeatureNullable, false) + ? optionTypeName.Name + "_" // Escape colliding names + : optionTypeName.Name; + return this.GenerateMethod( + // return new {VariantType}({VariantEnum}.{Option}, value); + body: SyntaxFactory.Block( + SyntaxFactory.ReturnStatement( + SyntaxFactory.ObjectCreationExpression( + variantTypeName.ToTypeSyntax(false) + ) + .WithArgumentList( + SyntaxFactory.ArgumentList( + SyntaxFactory.SeparatedList( + new SyntaxNodeOrToken[]{ + SyntaxFactory.Argument( + SyntaxFactory.MemberAccessExpression( + SyntaxKind.SimpleMemberAccessExpression, + enumTypeName.ToTypeSyntax(this.FeatureNullable), + SyntaxFactory.IdentifierName(optionTypeName.Name) + ) + ), + SyntaxFactory.Token(SyntaxKind.CommaToken), + SyntaxFactory.Argument(arg) + } + ) + ) + ) + ) + ), + access: AccessType.Public, + isStatic: true, + isAsync: false, + returnTypes: new List { new TypedValueName(variantTypeName, optionTypeName) }, + name: methodName, + attributes: null, + parameters: creationParameters?.ToArray() ?? Array.Empty<(TypeName, string)>() + ); + } + + internal ClassDeclarationSyntax GenerateRecord( + TypeName recordTypeName, + RecordSourceCodeType record, + Stack parentTypeIds + ) + { + (ResolvedName Name, ResolvedType Type, bool OptionalOverridden) ResolveField(RecordSourceCodeType.RecordField option, int i) + { + string nameContext = option.Type.IsPredefinedType + ? option.Tag.Name + : option.Tag.Name + "Info"; // If need to generate sub type, add suffix to avoid name collision + ResolvedType resolvedType = this.ResolveType(option.Type, nameContext, recordTypeName, parentTypeIds); + return (option.Tag, resolvedType, option.OptionalOverridden); + } + List<(ResolvedName Tag, ResolvedType Type, bool OptionalOverridden)> resolvedFields = record.Fields + .Select(ResolveField) + .ToList(); + List subItems = resolvedFields + .SelectMany(f => f.Type.GeneratedSyntax ?? Array.Empty()) + .ToList(); + + List properties = resolvedFields + .Select((f, i) => + { + ResolvedName propertyName = f.Tag; + if (propertyName.Name == recordTypeName.BuildName(this.FeatureNullable, false)) + { + // Cant match the class name + propertyName = new ResolvedName( + name: propertyName.Name + "_", // TODO best way to escape it. @ does not work + candidTag: propertyName.CandidTag + ); + } + List attributes = new List(); + if (propertyName.CandidTag.Name == null) + { + // [CandidTag({candidTag})] + // Indicate there is no associated name, just an id + // Usually with tuples like 'record { text; nat; }' + attributes.Add(AttributeInfo.FromType(propertyName.CandidTag)); + } + else if (propertyName.CandidTag != propertyName.Name) + { + // [CandidName("{fieldCandidName}")] + // Only add attribute if the name is different + attributes.Add(AttributeInfo.FromType(propertyName.CandidTag.Name!)); + } + TypeName typeName = f.Type.Name; + if (f.OptionalOverridden) + { + // [CandidOptional] + attributes.Add(AttributeInfo.FromType()); + // Add '?' if applicible + typeName = new NullableTypeName(typeName); + } + CandidType? candidType = typeName.GetCandidType(); + if (candidType != null) + { + // [CandidTypeDefinition("{typeDefinition}")] + string candidTypeDefinition = CandidTextGenerator.Generate(candidType, indentType: CandidTextGenerator.IndentType.None); + attributes.Add(AttributeInfo.FromType(candidTypeDefinition)); + } + + + + // public {fieldType} {fieldName} {{ get; set; }} + return new ClassProperty( + name: propertyName.Name, + type: typeName, + access: AccessType.Public, + hasSetter: true, + attributes.ToArray() + ); + }) + .ToList(); + + return this.GenerateClass( + name: recordTypeName, + properties: properties, + optionalProperties: null, + subTypes: subItems, + emptyConstructorAccess: AccessType.Public + ); + + } + + private PropertyDeclarationSyntax? GenerateProperty(ClassProperty property) + { + if (property.Type == null) + { + return null; + } + List accessors = new() + { + // Add get in `{ get; } + SyntaxFactory + .AccessorDeclaration(SyntaxKind.GetAccessorDeclaration) + .WithSemicolonToken(SyntaxFactory.Token(SyntaxKind.SemicolonToken)) + }; + if (property.HasSetter) + { + // Add set in `{ get; set; }` + accessors.Add( + SyntaxFactory + .AccessorDeclaration(SyntaxKind.SetAccessorDeclaration) + .WithSemicolonToken(SyntaxFactory.Token(SyntaxKind.SemicolonToken)) + ); + } + + PropertyDeclarationSyntax propertySyntax = SyntaxFactory + .PropertyDeclaration( + property.Type.ToTypeSyntax(this.FeatureNullable), + SyntaxFactory.Identifier(property.Name) + ) + .WithAccessorList(SyntaxFactory.AccessorList( + SyntaxFactory.List(accessors) + )); + + // Add `public`, `private`, etc... + SyntaxToken? accessSyntaxToken = this.GenerateAccessToken(property.Access); + if (accessSyntaxToken != null) + { + propertySyntax = propertySyntax + .WithModifiers(SyntaxTokenList.Create(accessSyntaxToken.Value)); + } + if (property.Attributes?.Any() == true) + { + IEnumerable attributes = property.Attributes + .Select(a => this.GenerateAttribute(a)); + propertySyntax = propertySyntax + .WithAttributeLists(SyntaxFactory.List(attributes)); + } + + return propertySyntax; + } + + private EnumDeclarationSyntax GenerateEnum(TypeName enumName, List<(ResolvedName Name, TypeName? Type)> values) + { + // Build enum options based on the values + IEnumerable enumOptions = values + .Select(v => + { + List attributeList = new(); + + if (v.Name.CandidTag.Name == null) + { + // [CandidTagId({candidTagId})] + // Indicate there is no associated name, just an id + // Usually with tuples like 'record { text; nat; }' + attributeList.Add(this.GenerateAttribute( + new AttributeInfo(SimpleTypeName.FromType(), v.Name.CandidTag.Id) + )); + } + else if (v.Name.CandidTag.Name != v.Name.Name) + { + // [CandidName({candidName}] + // Only add if names differ + attributeList.Add(this.GenerateAttribute( + new AttributeInfo(SimpleTypeName.FromType(), v.Name.CandidTag.Name!) + )); + } + return SyntaxFactory + // {optionName}, + .EnumMemberDeclaration(SyntaxFactory.Identifier(v.Name.Name)) + // Add attributes + .WithAttributeLists(SyntaxFactory.List(attributeList)); + }); + + // Create comma seperators between the enum options + IEnumerable enumSeperators = Enumerable.Range(0, values.Count - 1) + .Select(i => SyntaxFactory.Token(SyntaxKind.CommaToken)); + + // public enum {enumName} + return SyntaxFactory.EnumDeclaration(enumName.BuildName(this.FeatureNullable, false)) + .WithModifiers( + // public + SyntaxFactory.TokenList(SyntaxFactory.Token(SyntaxKind.PublicKeyword)) + ) + .WithMembers( + // Each enum option + SyntaxFactory.SeparatedList(enumOptions, enumSeperators) + ); + } + + + + private AttributeListSyntax GenerateAttribute(AttributeInfo attribute) + { + IEnumerable? arguments = attribute.Args? + .Select(a => + { + return a switch + { + string s => SyntaxFactory.LiteralExpression( + SyntaxKind.StringLiteralExpression, + SyntaxFactory.Literal(s) + ), + uint i => SyntaxFactory.LiteralExpression( + SyntaxKind.NumericLiteralExpression, + SyntaxFactory.Literal(i) + ), + CandidTag t => t.Name != null + ? SyntaxFactory.LiteralExpression( + SyntaxKind.StringLiteralExpression, + SyntaxFactory.Literal(t.Name) + ) + : SyntaxFactory.LiteralExpression( + SyntaxKind.NumericLiteralExpression, + SyntaxFactory.Literal(t.Id) + ), + TypeName type => SyntaxFactory.TypeOfExpression(type.ToTypeSyntax(this.FeatureNullable)), + _ => throw new NotImplementedException() + }; + }) + .Select(SyntaxFactory.AttributeArgument); + + string typeName = attribute.Type.BuildName(this.FeatureNullable, true); + typeName = typeName[..^"Attribute".Length]; // Remove suffix + AttributeSyntax syntax = SyntaxFactory.Attribute(SyntaxFactory.IdentifierName(typeName)); + if (arguments?.Any() == true) + { + syntax = syntax.WithArgumentList( + SyntaxFactory.AttributeArgumentList( + SyntaxFactory.SeparatedList(arguments) + ) + ); + } + + return SyntaxFactory.AttributeList( + SyntaxFactory.SingletonSeparatedList( + syntax + ) + ); + } + + private (MethodDeclarationSyntax Method, List SubTypes) GenerateFuncMethod( + string csharpName, + string candidName, + ServiceSourceCodeType.Func info, + TypeName clientName, + RoslynTypeResolver typeResolver, + string candidConverterProperty, + Stack parentTypeIds + ) + { + (ResolvedName Name, ResolvedType Type) ResolveType((ResolvedName Name, SourceCodeType Type) type, int i) + { + string nameContext = StringUtil.ToPascalCase(csharpName) + StringUtil.ToPascalCase(type.Name.Name); + ResolvedType resolvedType = typeResolver.ResolveType(type.Type, nameContext, parentType: clientName, parentTypeIds); + return (type.Name, resolvedType); + } + + List<(ResolvedName Name, ResolvedType Type)> resolvedArgTypes = info.ArgTypes + .Select(ResolveType) + .ToList(); + List<(ResolvedName Name, ResolvedType Type)> resolvedReturnTypes = info.ReturnTypes + .Select(ResolveType) + .ToList(); + + List<(TypeName, string)> argTypes = resolvedArgTypes + .Select(t => (t.Type.Name, t.Name.ToCamelCase())) + .ToList(); + List returnTypes = resolvedReturnTypes + .Select(t => new TypedValueName(t.Type.Name, t.Name)) + .ToList(); + + BlockSyntax body = this.GenerateFuncMethodBody( + candidName: candidName, + argTypes, + returnTypes, + isOneway: info.IsOneway, + isQuery: info.IsQuery, + typeResolver: typeResolver, + candidConverterProperty + ); + List subTypes = resolvedArgTypes + .Where(t => t.Type.GeneratedSyntax != null) + .SelectMany(t => t.Type.GeneratedSyntax!) + .Concat(resolvedReturnTypes + .Where(t => t.Type.GeneratedSyntax != null) + .SelectMany(t => t.Type.GeneratedSyntax!) + ) + .ToList(); + + MethodDeclarationSyntax method = this.GenerateMethod( + body: body, + access: AccessType.Public, + isStatic: false, + isAsync: true, + returnTypes: returnTypes, + name: csharpName, + attributes: null, + parameters: argTypes.ToArray() + ); + return (method, subTypes); + } + + private BlockSyntax GenerateFuncMethodBody( + string candidName, + List<(TypeName Type, string Name)> argTypes, + List returnTypes, + bool isOneway, + bool isQuery, + RoslynTypeResolver typeResolver, + string candidConverterProperty + ) + { + ArgumentSyntax converterArg = SyntaxFactory.Argument( + SyntaxFactory.MemberAccessExpression( + SyntaxKind.SimpleMemberAccessExpression, + SyntaxFactory.ThisExpression(), + SyntaxFactory.IdentifierName(candidConverterProperty) + ) + ); + // Build arguments for conversion to CandidArg + IEnumerable fromCandidArguments = argTypes + .Select(t => + { + // `CandidTypedValue.FromObject({argX}, this.Converter);` + string argName = this.NameHelper.ToCamelCase(t.Name); + ExpressionSyntax expression = SyntaxFactory.InvocationExpression( + SyntaxFactory.MemberAccessExpression( + SyntaxKind.SimpleMemberAccessExpression, + SyntaxFactory.IdentifierName(typeof(CandidTypedValue).FullName!), + SyntaxFactory.IdentifierName(nameof(CandidTypedValue.FromObject)) + ) + ) + .WithArgumentList( + SyntaxFactory.ArgumentList( + SyntaxFactory.SeparatedList(new[] { + SyntaxFactory.Argument(SyntaxFactory.IdentifierName(argName.ToSyntaxIdentifier())), + converterArg + }) + ) + ); + return SyntaxFactory.Argument(expression); + }); + + // Build candid arg + // `CandidArg arg = CandidArg.FromCandid(arg0, arg1, ...);` + const string argName = "arg"; + VariableDeclarationSyntax argVariable = SyntaxFactory + .VariableDeclaration(SyntaxFactory.IdentifierName(typeof(CandidArg).FullName!)) + .WithVariables( + SyntaxFactory.SingletonSeparatedList( + SyntaxFactory.VariableDeclarator( + SyntaxFactory.Identifier(argName) + ) + .WithInitializer( + SyntaxFactory.EqualsValueClause( + SyntaxFactory.InvocationExpression( + SyntaxFactory.MemberAccessExpression( + SyntaxKind.SimpleMemberAccessExpression, + SyntaxFactory.IdentifierName(typeof(CandidArg).FullName!), + SyntaxFactory.IdentifierName(nameof(CandidArg.FromCandid)) + ) + ) + .WithArgumentList( + SyntaxFactory.ArgumentList( + SyntaxFactory.SeparatedList(fromCandidArguments) + ) + ) + ) + ) + ) + ); + + var statements = new List + { + SyntaxFactory.LocalDeclarationStatement(argVariable), + }; + + const string variableName = "reply"; + if (isOneway) + { + // Fire and forget + // No return args + // Query and Oneway are exclusive annotations in the IC + // `await this.Agent.CallAsync(this.CanisterId, {methodName}, arg)` + StatementSyntax invokeCall = this.GenerateCall(candidName, argName); + statements.Add(invokeCall); + return SyntaxFactory.Block(statements); + } + if (isQuery) + { + const string responseName = "reply"; + // `CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, {methodName}, arg);` + StatementSyntax invokeQueryCall = this.GenerateQueryCall(candidName, argName, responseName); + statements.Add(invokeQueryCall); + + } + else + { + // `CandidArg reply = await this.Agent.CallAsync(this.CanisterId, {methodName}, arg)` + string? replyVariableName = returnTypes.Any() ? variableName : null; // Dont include reply variable if its not used + StatementSyntax invokeCallAndWait = this.GenerateCallAndWait(candidName, argName, replyVariableName); + statements.Add(invokeCallAndWait); + + } + if (returnTypes.Any()) + { + statements.Add( + // `return reply.ToObjects<{T1}, {T2}, ...>(candidConverter);` + SyntaxFactory.ReturnStatement( + SyntaxFactory.InvocationExpression( + SyntaxFactory.MemberAccessExpression( + SyntaxKind.SimpleMemberAccessExpression, + SyntaxFactory.IdentifierName(variableName), + SyntaxFactory.GenericName( + SyntaxFactory.Identifier(nameof(CandidArg.ToObjects)) + ) + .WithTypeArgumentList( + SyntaxFactory.TypeArgumentList( + SyntaxFactory.SeparatedList( + returnTypes + .Select(t => t.Type.ToTypeSyntax(this.FeatureNullable)) + ) + ) + ) + ) + ) + .WithArgumentList( + SyntaxFactory.ArgumentList( + SyntaxFactory.SingletonSeparatedList(converterArg) + ) + ) + ) + ); + } + return SyntaxFactory.Block(statements); + } + + private StatementSyntax GenerateQueryCall(string methodName, string argName, string responseName) + { + return SyntaxFactory.LocalDeclarationStatement( + SyntaxFactory.VariableDeclaration( + SyntaxFactory.IdentifierName(typeof(CandidArg).FullName!) + ) + .WithVariables( + SyntaxFactory.SingletonSeparatedList( + SyntaxFactory.VariableDeclarator( + SyntaxFactory.Identifier(responseName) + ) + .WithInitializer( + SyntaxFactory.EqualsValueClause( + SyntaxFactory.AwaitExpression( + SyntaxFactory.InvocationExpression( + SyntaxFactory.MemberAccessExpression( + SyntaxKind.SimpleMemberAccessExpression, + SyntaxFactory.MemberAccessExpression( + SyntaxKind.SimpleMemberAccessExpression, + SyntaxFactory.ThisExpression(), + SyntaxFactory.IdentifierName("Agent") + ), + SyntaxFactory.IdentifierName(nameof(IAgent.QueryAsync)) + ) + ) + .WithArgumentList( + SyntaxFactory.ArgumentList( + SyntaxFactory.SeparatedList( + new SyntaxNodeOrToken[]{ + SyntaxFactory.Argument( + SyntaxFactory.MemberAccessExpression( + SyntaxKind.SimpleMemberAccessExpression, + SyntaxFactory.ThisExpression(), + SyntaxFactory.IdentifierName("CanisterId") + ) + ), + SyntaxFactory.Token(SyntaxKind.CommaToken), + SyntaxFactory.Argument( + SyntaxFactory.LiteralExpression( + SyntaxKind.StringLiteralExpression, + SyntaxFactory.Literal(methodName) + ) + ), + SyntaxFactory.Token(SyntaxKind.CommaToken), + SyntaxFactory.Argument( + SyntaxFactory.IdentifierName(argName) + ) + } + ) + ) + ) + ) + ) + ) + ) + ) + ); + } + + private StatementSyntax GenerateCallAndWait(string methodName, string argName, string? variableName) + { + InvocationExpressionSyntax apiCall = SyntaxFactory.InvocationExpression( + SyntaxFactory.MemberAccessExpression( + SyntaxKind.SimpleMemberAccessExpression, + SyntaxFactory.MemberAccessExpression( + SyntaxKind.SimpleMemberAccessExpression, + SyntaxFactory.ThisExpression(), + SyntaxFactory.IdentifierName("Agent") + ), + SyntaxFactory.IdentifierName("CallAsync") + ) + ) + .WithArgumentList( + SyntaxFactory.ArgumentList( + SyntaxFactory.SeparatedList( + new SyntaxNodeOrToken[] { + SyntaxFactory.Argument( + SyntaxFactory.MemberAccessExpression( + SyntaxKind.SimpleMemberAccessExpression, + SyntaxFactory.ThisExpression(), + SyntaxFactory.IdentifierName("CanisterId") + ) + ), + SyntaxFactory.Token(SyntaxKind.CommaToken), + SyntaxFactory.Argument( + SyntaxFactory.LiteralExpression( + SyntaxKind.StringLiteralExpression, + SyntaxFactory.Literal(methodName) + ) + ), + SyntaxFactory.Token(SyntaxKind.CommaToken), + SyntaxFactory.Argument( + SyntaxFactory.IdentifierName(argName) + ) + } + ) + ) + ); + if (variableName != null) + { + // `CandidArg reply = await ...` + return SyntaxFactory.LocalDeclarationStatement( + SyntaxFactory.VariableDeclaration( + SyntaxFactory.IdentifierName(typeof(CandidArg).FullName!) + ) + .WithVariables( + SyntaxFactory.SingletonSeparatedList( + SyntaxFactory.VariableDeclarator( + SyntaxFactory.Identifier(variableName) + ) + .WithInitializer( + SyntaxFactory.EqualsValueClause( + SyntaxFactory.AwaitExpression(apiCall) + ) + ) + ) + ) + ); + } + // No variable, just await + // `await ...` + + return SyntaxFactory.ExpressionStatement( + SyntaxFactory.AwaitExpression(apiCall) + ); + } + private StatementSyntax GenerateCall(string methodName, string argName) + { + InvocationExpressionSyntax apiCall = SyntaxFactory.InvocationExpression( + SyntaxFactory.MemberAccessExpression( + SyntaxKind.SimpleMemberAccessExpression, + SyntaxFactory.MemberAccessExpression( + SyntaxKind.SimpleMemberAccessExpression, + SyntaxFactory.ThisExpression(), + SyntaxFactory.IdentifierName("Agent") + ), + SyntaxFactory.IdentifierName("CallAsync") + ) + ) + .WithArgumentList( + SyntaxFactory.ArgumentList( + SyntaxFactory.SeparatedList( + new SyntaxNodeOrToken[] { + SyntaxFactory.Argument( + SyntaxFactory.MemberAccessExpression( + SyntaxKind.SimpleMemberAccessExpression, + SyntaxFactory.ThisExpression(), + SyntaxFactory.IdentifierName("CanisterId") + ) + ), + SyntaxFactory.Token(SyntaxKind.CommaToken), + SyntaxFactory.Argument( + SyntaxFactory.LiteralExpression( + SyntaxKind.StringLiteralExpression, + SyntaxFactory.Literal(methodName) + ) + ), + SyntaxFactory.Token(SyntaxKind.CommaToken), + SyntaxFactory.Argument( + SyntaxFactory.IdentifierName(argName) + ) + } + ) + ) + ); + return SyntaxFactory.ExpressionStatement( + SyntaxFactory.AwaitExpression(apiCall) + ); + } + + private ConstructorDeclarationSyntax GenerateConstructor( + TypeName name, + AccessType access, + List<(string Name, TypeName Type, bool SetValue)> properties, + List<(string Name, TypeName Type, bool SetValue)>? optionalProperties = null + ) + { + optionalProperties ??= new List<(string Name, TypeName Type, bool SetValue)>(); + IEnumerable propertyAssignments = properties.Where(p => p.SetValue) + .Concat(optionalProperties.Where(p => p.SetValue)) + .Select(p => + { + string argName = this.NameHelper.ToCamelCase(p.Name); + var value = SyntaxFactory.IdentifierName(argName); + return SyntaxFactory.ExpressionStatement( + SyntaxFactory.AssignmentExpression( + SyntaxKind.SimpleAssignmentExpression, + SyntaxFactory.MemberAccessExpression( + SyntaxKind.SimpleMemberAccessExpression, + SyntaxFactory.ThisExpression(), + SyntaxFactory.IdentifierName(p.Name) + ), + value + ) + ); + }); + + BlockSyntax body = SyntaxFactory.Block(propertyAssignments); + + + ConstructorDeclarationSyntax constructor = SyntaxFactory + .ConstructorDeclaration( + SyntaxFactory.Identifier(name.BuildName(this.FeatureNullable, false)) + ) + .WithParameterList( + SyntaxFactory.ParameterList( + SyntaxFactory.SeparatedList( + properties + .Select(p => + { + string argName = this.NameHelper.ToCamelCase(p.Name); + return SyntaxFactory.Parameter( + SyntaxFactory.Identifier(argName) + ) + .WithType(p.Type!.ToTypeSyntax(this.FeatureNullable)); + }) + .Concat(optionalProperties + .Select(p => + { + string argName = this.NameHelper.ToCamelCase(p.Name); + return SyntaxFactory.Parameter( + SyntaxFactory.Identifier(argName) + ) + .WithType(p.Type!.ToTypeSyntax(this.FeatureNullable)) + // Add `= default` to the end + .WithDefault(SyntaxFactory.EqualsValueClause( + SyntaxFactory.LiteralExpression( + SyntaxKind.DefaultLiteralExpression) + ) + ); + })) + ) + ) + ) + .WithBody(body); + + // Add access (public, private, ...) + SyntaxToken? accessSyntaxToken = this.GenerateAccessToken(access); + if (accessSyntaxToken != null) + { + constructor = constructor + .WithModifiers( + SyntaxFactory.TokenList(accessSyntaxToken.Value) + ); + } + + return constructor; + } + + private SyntaxToken? GenerateAccessToken(AccessType access) + { + SyntaxKind? accessKeyword = access switch + { + AccessType.None => null, + AccessType.Public => SyntaxKind.PublicKeyword, + AccessType.Private => SyntaxKind.PrivateKeyword, + AccessType.Protected => SyntaxKind.ProtectedKeyword, + _ => throw new NotImplementedException(), + }; + return accessKeyword == null ? null : SyntaxFactory.Token(accessKeyword.Value); + } + + private MethodDeclarationSyntax GenerateMethod( + BlockSyntax body, + AccessType access, + bool isStatic, + bool isAsync, + List? returnTypes, + string name, + List? attributes, + params (TypeName Type, string Name)[] parameters) + { + TypeSyntax? returnType = null; + if (returnTypes?.Any() == true) + { + if (returnTypes.Count == 1) + { + // Single return type + returnType = returnTypes[0].Type.ToTypeSyntax(this.FeatureNullable); + } + else + { + // Tuple of return types + returnType = SyntaxFactory.TupleType(SyntaxFactory.SeparatedList( + returnTypes + .Where(t => t != null) + .Select(t => SyntaxFactory.TupleElement(t.Type.ToTypeSyntax(this.FeatureNullable), (" " + t.Value.Name).ToSyntaxIdentifier())) + )); + } + } + + if (returnType == null) + { + if (isAsync) + { + // `Task` return type + returnType = SyntaxFactory.IdentifierName(typeof(Task).FullName!.ToSyntaxIdentifier()); + } + else + { + // `void` return type + returnType = SyntaxFactory.PredefinedType(SyntaxFactory.Token(SyntaxKind.VoidKeyword)); + } + } + else + { + if (isAsync) + { + // Wrap return type in Task. `Task<{returnType}>` + returnType = SyntaxFactory.GenericName(typeof(Task).FullName!.ToSyntaxIdentifier()) + .WithTypeArgumentList( + SyntaxFactory.TypeArgumentList( + SyntaxFactory.SingletonSeparatedList( + returnType + ) + ) + ); + } + } + + + List methodModifiers = new(); + + SyntaxToken? methodAccess = access switch + { + AccessType.None => null, + AccessType.Public => SyntaxFactory.Token(SyntaxKind.PublicKeyword), + AccessType.Private => SyntaxFactory.Token(SyntaxKind.PrivateKeyword), + AccessType.Protected => SyntaxFactory.Token(SyntaxKind.PropertyKeyword), + _ => throw new NotImplementedException(), + }; + + if (methodAccess != null) + { + methodModifiers.Add(methodAccess.Value); + } + + if (isAsync) + { + // Add `async` keyword to method modifiers + methodModifiers.Add(SyntaxFactory.Token(SyntaxKind.AsyncKeyword)); + } + if (isStatic) + { + // Add `static` keyword to method modifiers + methodModifiers.Add(SyntaxFactory.Token(SyntaxKind.StaticKeyword)); + } + + IEnumerable @params = parameters + .Select(p => + { + return SyntaxFactory + .Parameter(p.Name.ToSyntaxIdentifier()) + .WithType(p.Type.ToTypeSyntax(this.FeatureNullable)); + }); + var method = SyntaxFactory.MethodDeclaration(returnType, SyntaxFactory.Identifier(name)) + .WithModifiers(SyntaxFactory.TokenList(methodModifiers)) + .WithParameterList(SyntaxFactory.ParameterList(SyntaxFactory.SeparatedList(@params))) + .WithBody(body); + if (attributes?.Any() == true) + { + IEnumerable attributeSyntaxList = attributes + .Select(this.GenerateAttribute); + method = method.WithAttributeLists(SyntaxFactory.List(attributeSyntaxList)); + } + return method; + } + + private ClassDeclarationSyntax GenerateClass( + TypeName name, + List properties, + List? optionalProperties = null, + List? methods = null, + List? customProperties = null, + List? implementTypes = null, + List? attributes = null, + AccessType? emptyConstructorAccess = null, + List? subTypes = null) + { + if (properties.Any(p => p.Type == null)) + { + // TODO + throw new NotImplementedException("Null, empty or reserved properties are not yet supported"); + } + var uniquePropertyNames = new HashSet(); + ClassProperty FixDuplicates(ClassProperty property) + { + string name = property.Name; + int i = 0; + while (!uniquePropertyNames.Add(name)) + { + // Add number suffix till there are no duplicates + i++; + name = property.Name + i.ToString(); + } + if (i > 0) + { + return new ClassProperty(name, property.Type, property.Access, property.HasSetter, property.Attributes); + } + return property; + } + properties = properties + .Select(FixDuplicates) // Fix if there are duplicate names + .ToList(); + optionalProperties = optionalProperties + ?.Select(FixDuplicates) // Fix if there are duplicate names + .ToList(); + List constructors = new(); + IEnumerable properySyntaxList = properties + .Concat(optionalProperties ?? new List()) + .Select(this.GenerateProperty) + .Where(p => p != null)!; + if (customProperties != null) + { + properySyntaxList = properySyntaxList.Concat(customProperties); + } + if (properties.Any()) + { + // Only create constructor if there are properties + List<(string Name, TypeName Type, bool SetValue)> constructorProps = properties + .Where(p => p.Type != null) + .Select(p => (p.Name, p.Type!, true)) + .ToList(); + List<(string Name, TypeName Type, bool SetValue)>? constructorOptProps = optionalProperties? + .Where(p => p.Type != null) + .Select(p => (p.Name, p.Type!, true)) + .ToList(); + constructors.Add(this.GenerateConstructor(name, AccessType.Public, constructorProps, constructorOptProps)); + } + + if (emptyConstructorAccess != null) + { + // Empty Constrcutor for reflection + constructors.Add(this.GenerateConstructor( + name: name, + access: emptyConstructorAccess.Value, + properties: new List<(string Name, TypeName Type, bool SetValue)>() + )); + } + + ClassDeclarationSyntax classSyntax = SyntaxFactory.ClassDeclaration(name.BuildName(this.FeatureNullable, false)) + .WithModifiers(SyntaxFactory.TokenList( + // Make class public + SyntaxFactory.Token(SyntaxKind.PublicKeyword) + )) + .WithMembers(SyntaxFactory.List( + // Properties + properySyntaxList.Cast() + // Constructors + .Concat(constructors.Cast()) + // Methods + .Concat(methods?.Cast() ?? Array.Empty()) + // Subtypes + .Concat(subTypes?.Cast() ?? Array.Empty()) + )); + + + if (implementTypes?.Any() == true) + { + classSyntax = classSyntax + .WithBaseList( + SyntaxFactory.BaseList( + SyntaxFactory.SeparatedList( + implementTypes + .Select(t => SyntaxFactory.SimpleBaseType(t.ToTypeSyntax(this.FeatureNullable))) + .Cast() + .ToArray() + ) + ) + ); + } + if (attributes?.Any() == true) + { + classSyntax = classSyntax + .WithAttributeLists( + SyntaxFactory.List(attributes) + ); + } + return classSyntax; + + } + + private enum AccessType + { + None, + Public, + Private, + Protected + } + + private class ClassProperty + { + public AccessType Access { get; } + public string Name { get; } + public TypeName? Type { get; } + public bool IsNullable { get; } + public bool HasSetter { get; } + public AttributeInfo[]? Attributes { get; } + + public ClassProperty( + string name, + TypeName? type, + AccessType access, + bool hasSetter, + params AttributeInfo[]? attributes + ) + { + this.Access = access; + this.Name = name ?? throw new ArgumentNullException(nameof(name)); + this.Type = type; + this.HasSetter = hasSetter; + this.Attributes = attributes; + } + + + } + + } +} diff --git a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap index a83ffce9..4780631b 100644 --- a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap @@ -1,9 +1,8 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using System.Collections.Generic; -using EdjCase.ICP.Agent.Responses; namespace Test { diff --git a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap index a83ffce9..4780631b 100644 --- a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap @@ -1,9 +1,8 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using System.Collections.Generic; -using EdjCase.ICP.Agent.Responses; namespace Test { diff --git a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap index a83ffce9..4780631b 100644 --- a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap @@ -1,9 +1,8 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using System.Collections.Generic; -using EdjCase.ICP.Agent.Responses; namespace Test { diff --git a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap index a83ffce9..4780631b 100644 --- a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap @@ -1,9 +1,8 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using System.Collections.Generic; -using EdjCase.ICP.Agent.Responses; namespace Test { diff --git a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap index fdc518b4..3cd9fde2 100644 --- a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap @@ -1,9 +1,8 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using System.Collections.Generic; -using EdjCase.ICP.Agent.Responses; namespace Test { diff --git a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap index fdc518b4..3cd9fde2 100644 --- a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap @@ -1,9 +1,8 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using System.Collections.Generic; -using EdjCase.ICP.Agent.Responses; namespace Test { diff --git a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap index fdc518b4..3cd9fde2 100644 --- a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap @@ -1,9 +1,8 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using System.Collections.Generic; -using EdjCase.ICP.Agent.Responses; namespace Test { diff --git a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap index fdc518b4..3cd9fde2 100644 --- a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap @@ -1,9 +1,8 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using System.Collections.Generic; -using EdjCase.ICP.Agent.Responses; namespace Test { diff --git a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap index e613e1e8..17531654 100644 --- a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap @@ -1,9 +1,8 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using System.Collections.Generic; -using EdjCase.ICP.Agent.Responses; namespace Test { diff --git a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap index e613e1e8..17531654 100644 --- a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap @@ -1,9 +1,8 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using System.Collections.Generic; -using EdjCase.ICP.Agent.Responses; namespace Test { diff --git a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap index e613e1e8..17531654 100644 --- a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap @@ -1,9 +1,8 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using System.Collections.Generic; -using EdjCase.ICP.Agent.Responses; namespace Test { diff --git a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap index e613e1e8..17531654 100644 --- a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap @@ -1,9 +1,8 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using System.Collections.Generic; -using EdjCase.ICP.Agent.Responses; namespace Test { diff --git a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap index 217047c1..ec4731bf 100644 --- a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap @@ -1,9 +1,8 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using System.Collections.Generic; -using EdjCase.ICP.Agent.Responses; namespace Test { diff --git a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap index 217047c1..ec4731bf 100644 --- a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap @@ -1,9 +1,8 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using System.Collections.Generic; -using EdjCase.ICP.Agent.Responses; namespace Test { diff --git a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap index 217047c1..ec4731bf 100644 --- a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap @@ -1,9 +1,8 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using System.Collections.Generic; -using EdjCase.ICP.Agent.Responses; namespace Test { diff --git a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap index 217047c1..ec4731bf 100644 --- a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap @@ -1,9 +1,8 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using System.Collections.Generic; -using EdjCase.ICP.Agent.Responses; namespace Test { diff --git a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap index a83ffce9..4780631b 100644 --- a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap @@ -1,9 +1,8 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using System.Collections.Generic; -using EdjCase.ICP.Agent.Responses; namespace Test { diff --git a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap index a83ffce9..4780631b 100644 --- a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap @@ -1,9 +1,8 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using System.Collections.Generic; -using EdjCase.ICP.Agent.Responses; namespace Test { diff --git a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap index a83ffce9..4780631b 100644 --- a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap @@ -1,9 +1,8 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using System.Collections.Generic; -using EdjCase.ICP.Agent.Responses; namespace Test { diff --git a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap index a83ffce9..4780631b 100644 --- a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap @@ -1,9 +1,8 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using System.Collections.Generic; -using EdjCase.ICP.Agent.Responses; namespace Test { diff --git a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap index fdc518b4..3cd9fde2 100644 --- a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap @@ -1,9 +1,8 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using System.Collections.Generic; -using EdjCase.ICP.Agent.Responses; namespace Test { diff --git a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap index fdc518b4..3cd9fde2 100644 --- a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap @@ -1,9 +1,8 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using System.Collections.Generic; -using EdjCase.ICP.Agent.Responses; namespace Test { diff --git a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap index fdc518b4..3cd9fde2 100644 --- a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap @@ -1,9 +1,8 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using System.Collections.Generic; -using EdjCase.ICP.Agent.Responses; namespace Test { diff --git a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap index fdc518b4..3cd9fde2 100644 --- a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap @@ -1,9 +1,8 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using System.Collections.Generic; -using EdjCase.ICP.Agent.Responses; namespace Test { diff --git a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap index e613e1e8..17531654 100644 --- a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap @@ -1,9 +1,8 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using System.Collections.Generic; -using EdjCase.ICP.Agent.Responses; namespace Test { diff --git a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap index e613e1e8..17531654 100644 --- a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap @@ -1,9 +1,8 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using System.Collections.Generic; -using EdjCase.ICP.Agent.Responses; namespace Test { diff --git a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap index e613e1e8..17531654 100644 --- a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap @@ -1,9 +1,8 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using System.Collections.Generic; -using EdjCase.ICP.Agent.Responses; namespace Test { diff --git a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap index e613e1e8..17531654 100644 --- a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap @@ -1,9 +1,8 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using System.Collections.Generic; -using EdjCase.ICP.Agent.Responses; namespace Test { diff --git a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap index 217047c1..ec4731bf 100644 --- a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap @@ -1,9 +1,8 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using System.Collections.Generic; -using EdjCase.ICP.Agent.Responses; namespace Test { diff --git a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap index 217047c1..ec4731bf 100644 --- a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap @@ -1,9 +1,8 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using System.Collections.Generic; -using EdjCase.ICP.Agent.Responses; namespace Test { diff --git a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap index 217047c1..ec4731bf 100644 --- a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap @@ -1,9 +1,8 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using System.Collections.Generic; -using EdjCase.ICP.Agent.Responses; namespace Test { diff --git a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap index 217047c1..ec4731bf 100644 --- a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap @@ -1,9 +1,8 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using System.Collections.Generic; -using EdjCase.ICP.Agent.Responses; namespace Test { diff --git a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap index 4252024e..19e0cc14 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap @@ -1,10 +1,9 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; using System.Collections.Generic; -using EdjCase.ICP.Agent.Responses; using Token = EdjCase.ICP.Candid.Models.Principal; using OrderId = System.UInt32; diff --git a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap index 1cdef712..ad4c3ff5 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap @@ -1,10 +1,9 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; using System.Collections.Generic; -using EdjCase.ICP.Agent.Responses; using Token = EdjCase.ICP.Candid.Models.Principal; using OrderId = System.UInt32; diff --git a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap index a2379dff..24a1cb9a 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap @@ -1,10 +1,9 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; using System.Collections.Generic; -using EdjCase.ICP.Agent.Responses; using Token = EdjCase.ICP.Candid.Models.Principal; using OrderId = System.UInt32; diff --git a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap index e6399144..f3945901 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap @@ -1,10 +1,9 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; using System.Collections.Generic; -using EdjCase.ICP.Agent.Responses; using Token = EdjCase.ICP.Candid.Models.Principal; using OrderId = System.UInt32; diff --git a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap index 9c764ae4..de16ae42 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap @@ -1,10 +1,9 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; using System.Collections.Generic; -using EdjCase.ICP.Agent.Responses; using Token = EdjCase.ICP.Candid.Models.Principal; using OrderId = System.UInt32; diff --git a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap index eb58ebd5..84b66e9a 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap @@ -1,10 +1,9 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; using System.Collections.Generic; -using EdjCase.ICP.Agent.Responses; using Token = EdjCase.ICP.Candid.Models.Principal; using OrderId = System.UInt32; diff --git a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap index 9c69364c..f9583274 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap @@ -1,10 +1,9 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; using System.Collections.Generic; -using EdjCase.ICP.Agent.Responses; using Token = EdjCase.ICP.Candid.Models.Principal; using OrderId = System.UInt32; diff --git a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap index a0752f2b..0645c951 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap @@ -1,10 +1,9 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; using System.Collections.Generic; -using EdjCase.ICP.Agent.Responses; using Token = EdjCase.ICP.Candid.Models.Principal; using OrderId = System.UInt32; diff --git a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap index 472936f8..a4432db3 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap @@ -1,10 +1,9 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; using System.Collections.Generic; -using EdjCase.ICP.Agent.Responses; using Token = EdjCase.ICP.Candid.Models.Principal; using OrderId = System.UInt32; diff --git a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap index a42d2d0b..b03b9327 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap @@ -1,10 +1,9 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; using System.Collections.Generic; -using EdjCase.ICP.Agent.Responses; using Token = EdjCase.ICP.Candid.Models.Principal; using OrderId = System.UInt32; diff --git a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap index a153ab99..efd2159a 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap @@ -1,10 +1,9 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; using System.Collections.Generic; -using EdjCase.ICP.Agent.Responses; using Token = EdjCase.ICP.Candid.Models.Principal; using OrderId = System.UInt32; diff --git a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap index 36004d90..89395b5b 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap @@ -1,10 +1,9 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; using System.Collections.Generic; -using EdjCase.ICP.Agent.Responses; using Token = EdjCase.ICP.Candid.Models.Principal; using OrderId = System.UInt32; diff --git a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap index ede3ebee..83a910ea 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap @@ -1,10 +1,9 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; using System.Collections.Generic; -using EdjCase.ICP.Agent.Responses; using Token = EdjCase.ICP.Candid.Models.Principal; using OrderId = System.UInt32; diff --git a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap index eec35235..ba0ab72f 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap @@ -1,10 +1,9 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; using System.Collections.Generic; -using EdjCase.ICP.Agent.Responses; using Token = EdjCase.ICP.Candid.Models.Principal; using OrderId = System.UInt32; diff --git a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap index 74f78570..96b9af9c 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap @@ -1,10 +1,9 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; using System.Collections.Generic; -using EdjCase.ICP.Agent.Responses; using Token = EdjCase.ICP.Candid.Models.Principal; using OrderId = System.UInt32; diff --git a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap index ac1208d0..55406cba 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap @@ -1,10 +1,9 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; using System.Collections.Generic; -using EdjCase.ICP.Agent.Responses; using Token = EdjCase.ICP.Candid.Models.Principal; using OrderId = System.UInt32; diff --git a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap index efadbde5..4714e572 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap @@ -1,10 +1,9 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; using System.Collections.Generic; -using EdjCase.ICP.Agent.Responses; using Token = EdjCase.ICP.Candid.Models.Principal; using OrderId = System.UInt32; diff --git a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap index f0f0eaa7..9ed0133d 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap @@ -1,10 +1,9 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; using System.Collections.Generic; -using EdjCase.ICP.Agent.Responses; using Token = EdjCase.ICP.Candid.Models.Principal; using OrderId = System.UInt32; diff --git a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap index c10d09eb..beb3b935 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap @@ -1,10 +1,9 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; using System.Collections.Generic; -using EdjCase.ICP.Agent.Responses; using Token = EdjCase.ICP.Candid.Models.Principal; using OrderId = System.UInt32; diff --git a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap index 5c4d1eb1..6eacae98 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap @@ -1,10 +1,9 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; using System.Collections.Generic; -using EdjCase.ICP.Agent.Responses; using Token = EdjCase.ICP.Candid.Models.Principal; using OrderId = System.UInt32; diff --git a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap index d40f39ed..235d87b4 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap @@ -1,10 +1,9 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; using System.Collections.Generic; -using EdjCase.ICP.Agent.Responses; using Token = EdjCase.ICP.Candid.Models.Principal; using OrderId = System.UInt32; diff --git a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap index 5000034e..e7cb6a86 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap @@ -1,10 +1,9 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; using System.Collections.Generic; -using EdjCase.ICP.Agent.Responses; using Token = EdjCase.ICP.Candid.Models.Principal; using OrderId = System.UInt32; diff --git a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap index 0c5bc358..9c3da02f 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap @@ -1,10 +1,9 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; using System.Collections.Generic; -using EdjCase.ICP.Agent.Responses; using Token = EdjCase.ICP.Candid.Models.Principal; using OrderId = System.UInt32; diff --git a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap index ca51aa4a..d5083b29 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap @@ -1,10 +1,9 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; using System.Collections.Generic; -using EdjCase.ICP.Agent.Responses; using Token = EdjCase.ICP.Candid.Models.Principal; using OrderId = System.UInt32; diff --git a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap index 89602c0e..b07c5486 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap @@ -1,10 +1,9 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; using System.Collections.Generic; -using EdjCase.ICP.Agent.Responses; using Token = EdjCase.ICP.Candid.Models.Principal; using OrderId = System.UInt32; diff --git a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap index c940885d..496e446b 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap @@ -1,10 +1,9 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; using System.Collections.Generic; -using EdjCase.ICP.Agent.Responses; using Token = EdjCase.ICP.Candid.Models.Principal; using OrderId = System.UInt32; diff --git a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap index 1fdae881..a45ab126 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap @@ -1,10 +1,9 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; using System.Collections.Generic; -using EdjCase.ICP.Agent.Responses; using Token = EdjCase.ICP.Candid.Models.Principal; using OrderId = System.UInt32; diff --git a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap index 3359d2f7..df906f58 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap @@ -1,10 +1,9 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; using System.Collections.Generic; -using EdjCase.ICP.Agent.Responses; using Token = EdjCase.ICP.Candid.Models.Principal; using OrderId = System.UInt32; diff --git a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap index 73343a16..360de9eb 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap @@ -1,10 +1,9 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; using System.Collections.Generic; -using EdjCase.ICP.Agent.Responses; using Token = EdjCase.ICP.Candid.Models.Principal; using OrderId = System.UInt32; diff --git a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap index eea04b99..c4e5f8d7 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap @@ -1,10 +1,9 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; using System.Collections.Generic; -using EdjCase.ICP.Agent.Responses; using Token = EdjCase.ICP.Candid.Models.Principal; using OrderId = System.UInt32; diff --git a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap index eacfd549..899f11c8 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap @@ -1,10 +1,9 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; using System.Collections.Generic; -using EdjCase.ICP.Agent.Responses; using Token = EdjCase.ICP.Candid.Models.Principal; using OrderId = System.UInt32; diff --git a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap index c895cd0b..e8b0b9f0 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap @@ -1,10 +1,9 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; using System.Collections.Generic; -using EdjCase.ICP.Agent.Responses; using Token = EdjCase.ICP.Candid.Models.Principal; using OrderId = System.UInt32; diff --git a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap index 36f86e7c..f9a2bba8 100644 --- a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap @@ -1,9 +1,8 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; -using EdjCase.ICP.Agent.Responses; namespace Test { diff --git a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap index 36f86e7c..f9a2bba8 100644 --- a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap @@ -1,9 +1,8 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; -using EdjCase.ICP.Agent.Responses; namespace Test { diff --git a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap index 36f86e7c..f9a2bba8 100644 --- a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap @@ -1,9 +1,8 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; -using EdjCase.ICP.Agent.Responses; namespace Test { diff --git a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap index 36f86e7c..f9a2bba8 100644 --- a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap @@ -1,9 +1,8 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; -using EdjCase.ICP.Agent.Responses; namespace Test { diff --git a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap index 33a5c9d0..32577ae8 100644 --- a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap @@ -1,9 +1,8 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; -using EdjCase.ICP.Agent.Responses; namespace Test { diff --git a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap index 33a5c9d0..32577ae8 100644 --- a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap @@ -1,9 +1,8 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; -using EdjCase.ICP.Agent.Responses; namespace Test { diff --git a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap index 33a5c9d0..32577ae8 100644 --- a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap @@ -1,9 +1,8 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; -using EdjCase.ICP.Agent.Responses; namespace Test { diff --git a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap index 33a5c9d0..32577ae8 100644 --- a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap @@ -1,9 +1,8 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; -using EdjCase.ICP.Agent.Responses; namespace Test { diff --git a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap index df1f8c55..2f24e42b 100644 --- a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap @@ -1,9 +1,8 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; -using EdjCase.ICP.Agent.Responses; namespace Test { diff --git a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap index df1f8c55..2f24e42b 100644 --- a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap @@ -1,9 +1,8 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; -using EdjCase.ICP.Agent.Responses; namespace Test { diff --git a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap index df1f8c55..2f24e42b 100644 --- a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap @@ -1,9 +1,8 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; -using EdjCase.ICP.Agent.Responses; namespace Test { diff --git a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap index df1f8c55..2f24e42b 100644 --- a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap @@ -1,9 +1,8 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; -using EdjCase.ICP.Agent.Responses; namespace Test { diff --git a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap index 4a87f2e4..61f40f52 100644 --- a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap @@ -1,9 +1,8 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; -using EdjCase.ICP.Agent.Responses; namespace Test { diff --git a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap index 4a87f2e4..61f40f52 100644 --- a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap @@ -1,9 +1,8 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; -using EdjCase.ICP.Agent.Responses; namespace Test { diff --git a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap index 4a87f2e4..61f40f52 100644 --- a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap @@ -1,9 +1,8 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; -using EdjCase.ICP.Agent.Responses; namespace Test { diff --git a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap index 4a87f2e4..61f40f52 100644 --- a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap @@ -1,9 +1,8 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; -using EdjCase.ICP.Agent.Responses; namespace Test { diff --git a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap index 7e05167e..a8c31e5a 100644 --- a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap @@ -1,9 +1,8 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; -using EdjCase.ICP.Agent.Responses; namespace Test { diff --git a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap index 7e05167e..a8c31e5a 100644 --- a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap @@ -1,9 +1,8 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; -using EdjCase.ICP.Agent.Responses; namespace Test { diff --git a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap index 7e05167e..a8c31e5a 100644 --- a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap @@ -1,9 +1,8 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; -using EdjCase.ICP.Agent.Responses; namespace Test { diff --git a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap index 7e05167e..a8c31e5a 100644 --- a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap @@ -1,9 +1,8 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; -using EdjCase.ICP.Agent.Responses; namespace Test { diff --git a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap index f74b8ecb..65421a19 100644 --- a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap @@ -1,9 +1,8 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; -using EdjCase.ICP.Agent.Responses; namespace Test { diff --git a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap index f74b8ecb..65421a19 100644 --- a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap @@ -1,9 +1,8 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; -using EdjCase.ICP.Agent.Responses; namespace Test { diff --git a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap index f74b8ecb..65421a19 100644 --- a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap @@ -1,9 +1,8 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; -using EdjCase.ICP.Agent.Responses; namespace Test { diff --git a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap index f74b8ecb..65421a19 100644 --- a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap @@ -1,9 +1,8 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; -using EdjCase.ICP.Agent.Responses; namespace Test { diff --git a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap index 423af5b2..986ff6f9 100644 --- a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap @@ -1,9 +1,8 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; -using EdjCase.ICP.Agent.Responses; namespace Test { diff --git a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap index 423af5b2..986ff6f9 100644 --- a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap @@ -1,9 +1,8 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; -using EdjCase.ICP.Agent.Responses; namespace Test { diff --git a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap index 423af5b2..986ff6f9 100644 --- a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap @@ -1,9 +1,8 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; -using EdjCase.ICP.Agent.Responses; namespace Test { diff --git a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap index 423af5b2..986ff6f9 100644 --- a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap @@ -1,9 +1,8 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; -using EdjCase.ICP.Agent.Responses; namespace Test { diff --git a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap index 740ec9d5..f1903881 100644 --- a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap @@ -1,9 +1,8 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; -using EdjCase.ICP.Agent.Responses; namespace Test { diff --git a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap index 740ec9d5..f1903881 100644 --- a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap @@ -1,9 +1,8 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; -using EdjCase.ICP.Agent.Responses; namespace Test { diff --git a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap index 740ec9d5..f1903881 100644 --- a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap @@ -1,9 +1,8 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; -using EdjCase.ICP.Agent.Responses; namespace Test { diff --git a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap index 740ec9d5..f1903881 100644 --- a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap @@ -1,9 +1,8 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; -using EdjCase.ICP.Agent.Responses; namespace Test { diff --git a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap index 0896079b..4b31108e 100644 --- a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap @@ -1,9 +1,8 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; -using EdjCase.ICP.Agent.Responses; namespace Test { diff --git a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap index 0896079b..4b31108e 100644 --- a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap @@ -1,9 +1,8 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; -using EdjCase.ICP.Agent.Responses; namespace Test { diff --git a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap index 0896079b..4b31108e 100644 --- a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap @@ -1,9 +1,8 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; -using EdjCase.ICP.Agent.Responses; namespace Test { diff --git a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap index 0896079b..4b31108e 100644 --- a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap @@ -1,9 +1,8 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; -using EdjCase.ICP.Agent.Responses; namespace Test { diff --git a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap index 321a0502..1abdbfbe 100644 --- a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap @@ -1,9 +1,8 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; -using EdjCase.ICP.Agent.Responses; namespace Test { diff --git a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap index 321a0502..1abdbfbe 100644 --- a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap @@ -1,9 +1,8 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; -using EdjCase.ICP.Agent.Responses; namespace Test { diff --git a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap index 321a0502..1abdbfbe 100644 --- a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap @@ -1,9 +1,8 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; -using EdjCase.ICP.Agent.Responses; namespace Test { diff --git a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap index 321a0502..1abdbfbe 100644 --- a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap @@ -1,9 +1,8 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; -using EdjCase.ICP.Agent.Responses; namespace Test { diff --git a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap index e08c189b..d2c97be3 100644 --- a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap @@ -1,9 +1,8 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; -using EdjCase.ICP.Agent.Responses; namespace Test { diff --git a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap index e08c189b..d2c97be3 100644 --- a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap @@ -1,9 +1,8 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; -using EdjCase.ICP.Agent.Responses; namespace Test { diff --git a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap index e08c189b..d2c97be3 100644 --- a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap @@ -1,9 +1,8 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; -using EdjCase.ICP.Agent.Responses; namespace Test { diff --git a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap index e08c189b..d2c97be3 100644 --- a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap @@ -1,9 +1,8 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; -using EdjCase.ICP.Agent.Responses; namespace Test { diff --git a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap index 42f17f69..d1221f90 100644 --- a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap @@ -1,9 +1,8 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; -using EdjCase.ICP.Agent.Responses; namespace Test { diff --git a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap index 42f17f69..d1221f90 100644 --- a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap @@ -1,9 +1,8 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; -using EdjCase.ICP.Agent.Responses; namespace Test { diff --git a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap index 42f17f69..d1221f90 100644 --- a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap @@ -1,9 +1,8 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; -using EdjCase.ICP.Agent.Responses; namespace Test { diff --git a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap index 42f17f69..d1221f90 100644 --- a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap @@ -1,9 +1,8 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; -using EdjCase.ICP.Agent.Responses; namespace Test { diff --git a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap index 4b5d0600..61190d86 100644 --- a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap @@ -1,9 +1,8 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; -using EdjCase.ICP.Agent.Responses; namespace Test { diff --git a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap index 4b5d0600..61190d86 100644 --- a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap @@ -1,9 +1,8 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; -using EdjCase.ICP.Agent.Responses; namespace Test { diff --git a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap index 4b5d0600..61190d86 100644 --- a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap @@ -1,9 +1,8 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; -using EdjCase.ICP.Agent.Responses; namespace Test { diff --git a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap index 4b5d0600..61190d86 100644 --- a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap @@ -1,9 +1,8 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; -using EdjCase.ICP.Agent.Responses; namespace Test { diff --git a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap index 8612a26a..0ccacefd 100644 --- a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap @@ -1,9 +1,8 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; -using EdjCase.ICP.Agent.Responses; namespace Test { diff --git a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap index 8612a26a..0ccacefd 100644 --- a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap @@ -1,9 +1,8 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; -using EdjCase.ICP.Agent.Responses; namespace Test { diff --git a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap index 8612a26a..0ccacefd 100644 --- a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap @@ -1,9 +1,8 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; -using EdjCase.ICP.Agent.Responses; namespace Test { diff --git a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap index 8612a26a..0ccacefd 100644 --- a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap @@ -1,9 +1,8 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; -using EdjCase.ICP.Agent.Responses; namespace Test { diff --git a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap index e0ecf0ab..0d2d7c53 100644 --- a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap @@ -1,9 +1,8 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; -using EdjCase.ICP.Agent.Responses; namespace Test { diff --git a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap index e0ecf0ab..0d2d7c53 100644 --- a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap @@ -1,9 +1,8 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; -using EdjCase.ICP.Agent.Responses; namespace Test { diff --git a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap index e0ecf0ab..0d2d7c53 100644 --- a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap @@ -1,9 +1,8 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; -using EdjCase.ICP.Agent.Responses; namespace Test { diff --git a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap index e0ecf0ab..0d2d7c53 100644 --- a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap @@ -1,9 +1,8 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; -using EdjCase.ICP.Agent.Responses; namespace Test { diff --git a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap index 94d5d444..4b00b2c0 100644 --- a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap @@ -1,9 +1,8 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; -using EdjCase.ICP.Agent.Responses; namespace Test { diff --git a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap index 94d5d444..4b00b2c0 100644 --- a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap @@ -1,9 +1,8 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; -using EdjCase.ICP.Agent.Responses; namespace Test { diff --git a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap index 94d5d444..4b00b2c0 100644 --- a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap @@ -1,9 +1,8 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; -using EdjCase.ICP.Agent.Responses; namespace Test { diff --git a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap index 94d5d444..4b00b2c0 100644 --- a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap @@ -1,9 +1,8 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; -using EdjCase.ICP.Agent.Responses; namespace Test { diff --git a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap index ea3df0b6..786e3a95 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap @@ -1,10 +1,9 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; using System.Collections.Generic; -using EdjCase.ICP.Agent.Responses; namespace Test { diff --git a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap index 1f52b927..ebac31fb 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap @@ -1,10 +1,9 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; using System.Collections.Generic; -using EdjCase.ICP.Agent.Responses; namespace Test { diff --git a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap index a021faa7..3ae2bc79 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap @@ -1,10 +1,9 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; using System.Collections.Generic; -using EdjCase.ICP.Agent.Responses; namespace Test { diff --git a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap index 628ca552..85ad420f 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap @@ -1,10 +1,9 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; using System.Collections.Generic; -using EdjCase.ICP.Agent.Responses; namespace Test { diff --git a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap index d72dc1b9..b5c2d6ce 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap @@ -1,10 +1,9 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; using System.Collections.Generic; -using EdjCase.ICP.Agent.Responses; namespace Test { diff --git a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap index 71fcc883..026780ff 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap @@ -1,10 +1,9 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; using System.Collections.Generic; -using EdjCase.ICP.Agent.Responses; namespace Test { diff --git a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap index 4016458a..4e9e35d8 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap @@ -1,10 +1,9 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; using System.Collections.Generic; -using EdjCase.ICP.Agent.Responses; namespace Test { diff --git a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap index f9ef8079..58d15a54 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap @@ -1,10 +1,9 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; using System.Collections.Generic; -using EdjCase.ICP.Agent.Responses; namespace Test { diff --git a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap index c708c84f..f7d825c7 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap @@ -1,10 +1,9 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; using System.Collections.Generic; -using EdjCase.ICP.Agent.Responses; namespace Test { diff --git a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap index b83fc9aa..feb276fa 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap @@ -1,10 +1,9 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; using System.Collections.Generic; -using EdjCase.ICP.Agent.Responses; namespace Test { diff --git a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap index fd38e2c1..428020b1 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap @@ -1,10 +1,9 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; using System.Collections.Generic; -using EdjCase.ICP.Agent.Responses; namespace Test { diff --git a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap index a863f1eb..df7ada26 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap @@ -1,10 +1,9 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; using System.Collections.Generic; -using EdjCase.ICP.Agent.Responses; namespace Test { diff --git a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap index c3f7a5cd..340417e7 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap @@ -1,10 +1,9 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; using System.Collections.Generic; -using EdjCase.ICP.Agent.Responses; namespace Test { diff --git a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap index 7393f2a3..dc44fe44 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap @@ -1,10 +1,9 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; using System.Collections.Generic; -using EdjCase.ICP.Agent.Responses; namespace Test { diff --git a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap index 8e9f96af..86dba914 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap @@ -1,10 +1,9 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; using System.Collections.Generic; -using EdjCase.ICP.Agent.Responses; namespace Test { diff --git a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap index 22ac0597..2e46e593 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap @@ -1,10 +1,9 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; using System.Collections.Generic; -using EdjCase.ICP.Agent.Responses; namespace Test { diff --git a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap index cf3ec021..1d8f6f02 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap @@ -1,10 +1,9 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; using System.Collections.Generic; -using EdjCase.ICP.Agent.Responses; namespace Test { diff --git a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap index 497bdc18..72fbf4c6 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap @@ -1,10 +1,9 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; using System.Collections.Generic; -using EdjCase.ICP.Agent.Responses; namespace Test { diff --git a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap index 03ae62c7..ecf3e1d4 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap @@ -1,10 +1,9 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; using System.Collections.Generic; -using EdjCase.ICP.Agent.Responses; namespace Test { diff --git a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap index ce0d0da1..10b3d435 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap @@ -1,10 +1,9 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; using System.Collections.Generic; -using EdjCase.ICP.Agent.Responses; namespace Test { diff --git a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap index acc68ed9..b296b63e 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap @@ -1,10 +1,9 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; using System.Collections.Generic; -using EdjCase.ICP.Agent.Responses; namespace Test { diff --git a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap index a3f51f66..7b8fda7a 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap @@ -1,10 +1,9 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; using System.Collections.Generic; -using EdjCase.ICP.Agent.Responses; namespace Test { diff --git a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap index c5ca948e..8847bb23 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap @@ -1,10 +1,9 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; using System.Collections.Generic; -using EdjCase.ICP.Agent.Responses; namespace Test { diff --git a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap index 4cee15fc..23cc8db0 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap @@ -1,10 +1,9 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; using System.Collections.Generic; -using EdjCase.ICP.Agent.Responses; namespace Test { diff --git a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap index 43faa356..6e38bf41 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap @@ -1,10 +1,9 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; using System.Collections.Generic; -using EdjCase.ICP.Agent.Responses; namespace Test { diff --git a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap index 8b905f76..2eb4ffc9 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap @@ -1,10 +1,9 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; using System.Collections.Generic; -using EdjCase.ICP.Agent.Responses; namespace Test { diff --git a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap index 2a7285b7..0db501bb 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap @@ -1,10 +1,9 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; using System.Collections.Generic; -using EdjCase.ICP.Agent.Responses; namespace Test { diff --git a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap index 857cb822..75dfe929 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap @@ -1,10 +1,9 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; using System.Collections.Generic; -using EdjCase.ICP.Agent.Responses; namespace Test { diff --git a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap index 336fa7e8..4783f13e 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap @@ -1,10 +1,9 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; using System.Collections.Generic; -using EdjCase.ICP.Agent.Responses; namespace Test { diff --git a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap index 2dcec56c..534c12ba 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap @@ -1,10 +1,9 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; using System.Collections.Generic; -using EdjCase.ICP.Agent.Responses; namespace Test { diff --git a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap index fda4648f..8c24a132 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap @@ -1,10 +1,9 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; using System.Collections.Generic; -using EdjCase.ICP.Agent.Responses; namespace Test { diff --git a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap index 06e8d423..a936576e 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap @@ -1,10 +1,9 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; using System.Collections.Generic; -using EdjCase.ICP.Agent.Responses; namespace Test { From a07808c1e40bc39316729259da29eaf1eea010ab Mon Sep 17 00:00:00 2001 From: Gekctek Date: Wed, 5 Mar 2025 22:11:40 -0800 Subject: [PATCH 06/20] Identity to the client gen --- src/ClientGenerator/RoslynTypeResolver.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/ClientGenerator/RoslynTypeResolver.cs b/src/ClientGenerator/RoslynTypeResolver.cs index 6a789111..d42d548a 100644 --- a/src/ClientGenerator/RoslynTypeResolver.cs +++ b/src/ClientGenerator/RoslynTypeResolver.cs @@ -13,6 +13,7 @@ using EdjCase.ICP.Candid; using Org.BouncyCastle.Asn1.Cms; using EdjCase.ICP.Candid.Models.Types; +using System.Security.Principal; namespace EdjCase.ICP.ClientGenerator { @@ -229,6 +230,13 @@ public ClassDeclarationSyntax GenerateClient( List optionalProperties = new() { + // public IIdentity? Identity { get; set; } + new ClassProperty( + name: "Identity", + type: SimpleTypeName.FromType(isNullable: this.FeatureNullable), + access: AccessType.Public, + hasSetter: true + ), // public CandidConverter? Converter { get; } new ClassProperty( name: candidConverterProperty, From 1367718e80bb829c9503c0c27231e83cf93b8833 Mon Sep 17 00:00:00 2001 From: Gekctek Date: Wed, 5 Mar 2025 22:19:45 -0800 Subject: [PATCH 07/20] Adding identity to IAgent calls from Client --- src/ClientGenerator/RoslynTypeResolver.cs | 42 ++++++++++++++++- ...ies_False_OverrideOptionalValue_False.snap | 11 +++-- ...ties_False_OverrideOptionalValue_True.snap | 11 +++-- ...ties_True_OverrideOptionalValue_False.snap | 11 +++-- ...rties_True_OverrideOptionalValue_True.snap | 11 +++-- ...ies_False_OverrideOptionalValue_False.snap | 11 +++-- ...ties_False_OverrideOptionalValue_True.snap | 11 +++-- ...ties_True_OverrideOptionalValue_False.snap | 11 +++-- ...rties_True_OverrideOptionalValue_True.snap | 11 +++-- ...ies_False_OverrideOptionalValue_False.snap | 11 +++-- ...ties_False_OverrideOptionalValue_True.snap | 11 +++-- ...ties_True_OverrideOptionalValue_False.snap | 11 +++-- ...rties_True_OverrideOptionalValue_True.snap | 11 +++-- ...ies_False_OverrideOptionalValue_False.snap | 11 +++-- ...ties_False_OverrideOptionalValue_True.snap | 11 +++-- ...ties_True_OverrideOptionalValue_False.snap | 11 +++-- ...rties_True_OverrideOptionalValue_True.snap | 11 +++-- ...ies_False_OverrideOptionalValue_False.snap | 11 +++-- ...ties_False_OverrideOptionalValue_True.snap | 11 +++-- ...ties_True_OverrideOptionalValue_False.snap | 11 +++-- ...rties_True_OverrideOptionalValue_True.snap | 11 +++-- ...ies_False_OverrideOptionalValue_False.snap | 11 +++-- ...ties_False_OverrideOptionalValue_True.snap | 11 +++-- ...ties_True_OverrideOptionalValue_False.snap | 11 +++-- ...rties_True_OverrideOptionalValue_True.snap | 11 +++-- ...ies_False_OverrideOptionalValue_False.snap | 11 +++-- ...ties_False_OverrideOptionalValue_True.snap | 11 +++-- ...ties_True_OverrideOptionalValue_False.snap | 11 +++-- ...rties_True_OverrideOptionalValue_True.snap | 11 +++-- ...ies_False_OverrideOptionalValue_False.snap | 11 +++-- ...ties_False_OverrideOptionalValue_True.snap | 11 +++-- ...ties_True_OverrideOptionalValue_False.snap | 11 +++-- ...rties_True_OverrideOptionalValue_True.snap | 11 +++-- ...ies_False_OverrideOptionalValue_False.snap | 35 +++++++------- ...ties_False_OverrideOptionalValue_True.snap | 35 +++++++------- ...ties_True_OverrideOptionalValue_False.snap | 35 +++++++------- ...rties_True_OverrideOptionalValue_True.snap | 35 +++++++------- ...ies_False_OverrideOptionalValue_False.snap | 35 +++++++------- ...ties_False_OverrideOptionalValue_True.snap | 35 +++++++------- ...ties_True_OverrideOptionalValue_False.snap | 35 +++++++------- ...rties_True_OverrideOptionalValue_True.snap | 35 +++++++------- ...ies_False_OverrideOptionalValue_False.snap | 35 +++++++------- ...ties_False_OverrideOptionalValue_True.snap | 35 +++++++------- ...ties_True_OverrideOptionalValue_False.snap | 35 +++++++------- ...rties_True_OverrideOptionalValue_True.snap | 35 +++++++------- ...ies_False_OverrideOptionalValue_False.snap | 35 +++++++------- ...ties_False_OverrideOptionalValue_True.snap | 35 +++++++------- ...ties_True_OverrideOptionalValue_False.snap | 35 +++++++------- ...rties_True_OverrideOptionalValue_True.snap | 35 +++++++------- ...ies_False_OverrideOptionalValue_False.snap | 35 +++++++------- ...ties_False_OverrideOptionalValue_True.snap | 35 +++++++------- ...ties_True_OverrideOptionalValue_False.snap | 35 +++++++------- ...rties_True_OverrideOptionalValue_True.snap | 35 +++++++------- ...ies_False_OverrideOptionalValue_False.snap | 35 +++++++------- ...ties_False_OverrideOptionalValue_True.snap | 35 +++++++------- ...ties_True_OverrideOptionalValue_False.snap | 35 +++++++------- ...rties_True_OverrideOptionalValue_True.snap | 35 +++++++------- ...ies_False_OverrideOptionalValue_False.snap | 35 +++++++------- ...ties_False_OverrideOptionalValue_True.snap | 35 +++++++------- ...ties_True_OverrideOptionalValue_False.snap | 35 +++++++------- ...rties_True_OverrideOptionalValue_True.snap | 35 +++++++------- ...ies_False_OverrideOptionalValue_False.snap | 35 +++++++------- ...ties_False_OverrideOptionalValue_True.snap | 35 +++++++------- ...ties_True_OverrideOptionalValue_False.snap | 35 +++++++------- ...rties_True_OverrideOptionalValue_True.snap | 35 +++++++------- ...ies_False_OverrideOptionalValue_False.snap | 9 ++-- ...ties_False_OverrideOptionalValue_True.snap | 9 ++-- ...ties_True_OverrideOptionalValue_False.snap | 9 ++-- ...rties_True_OverrideOptionalValue_True.snap | 9 ++-- ...ies_False_OverrideOptionalValue_False.snap | 9 ++-- ...ties_False_OverrideOptionalValue_True.snap | 9 ++-- ...ties_True_OverrideOptionalValue_False.snap | 9 ++-- ...rties_True_OverrideOptionalValue_True.snap | 9 ++-- ...ies_False_OverrideOptionalValue_False.snap | 9 ++-- ...ties_False_OverrideOptionalValue_True.snap | 9 ++-- ...ties_True_OverrideOptionalValue_False.snap | 9 ++-- ...rties_True_OverrideOptionalValue_True.snap | 9 ++-- ...ies_False_OverrideOptionalValue_False.snap | 9 ++-- ...ties_False_OverrideOptionalValue_True.snap | 9 ++-- ...ties_True_OverrideOptionalValue_False.snap | 9 ++-- ...rties_True_OverrideOptionalValue_True.snap | 9 ++-- ...ies_False_OverrideOptionalValue_False.snap | 9 ++-- ...ties_False_OverrideOptionalValue_True.snap | 9 ++-- ...ties_True_OverrideOptionalValue_False.snap | 9 ++-- ...rties_True_OverrideOptionalValue_True.snap | 9 ++-- ...ies_False_OverrideOptionalValue_False.snap | 9 ++-- ...ties_False_OverrideOptionalValue_True.snap | 9 ++-- ...ties_True_OverrideOptionalValue_False.snap | 9 ++-- ...rties_True_OverrideOptionalValue_True.snap | 9 ++-- ...ies_False_OverrideOptionalValue_False.snap | 9 ++-- ...ties_False_OverrideOptionalValue_True.snap | 9 ++-- ...ties_True_OverrideOptionalValue_False.snap | 9 ++-- ...rties_True_OverrideOptionalValue_True.snap | 9 ++-- ...ies_False_OverrideOptionalValue_False.snap | 9 ++-- ...ties_False_OverrideOptionalValue_True.snap | 9 ++-- ...ties_True_OverrideOptionalValue_False.snap | 9 ++-- ...rties_True_OverrideOptionalValue_True.snap | 9 ++-- ...ies_False_OverrideOptionalValue_False.snap | 9 ++-- ...ties_False_OverrideOptionalValue_True.snap | 9 ++-- ...ties_True_OverrideOptionalValue_False.snap | 9 ++-- ...rties_True_OverrideOptionalValue_True.snap | 9 ++-- ...ies_False_OverrideOptionalValue_False.snap | 9 ++-- ...ties_False_OverrideOptionalValue_True.snap | 9 ++-- ...ties_True_OverrideOptionalValue_False.snap | 9 ++-- ...rties_True_OverrideOptionalValue_True.snap | 9 ++-- ...ies_False_OverrideOptionalValue_False.snap | 9 ++-- ...ties_False_OverrideOptionalValue_True.snap | 9 ++-- ...ties_True_OverrideOptionalValue_False.snap | 9 ++-- ...rties_True_OverrideOptionalValue_True.snap | 9 ++-- ...ies_False_OverrideOptionalValue_False.snap | 9 ++-- ...ties_False_OverrideOptionalValue_True.snap | 9 ++-- ...ties_True_OverrideOptionalValue_False.snap | 9 ++-- ...rties_True_OverrideOptionalValue_True.snap | 9 ++-- ...ies_False_OverrideOptionalValue_False.snap | 9 ++-- ...ties_False_OverrideOptionalValue_True.snap | 9 ++-- ...ties_True_OverrideOptionalValue_False.snap | 9 ++-- ...rties_True_OverrideOptionalValue_True.snap | 9 ++-- ...ies_False_OverrideOptionalValue_False.snap | 9 ++-- ...ties_False_OverrideOptionalValue_True.snap | 9 ++-- ...ties_True_OverrideOptionalValue_False.snap | 9 ++-- ...rties_True_OverrideOptionalValue_True.snap | 9 ++-- ...ies_False_OverrideOptionalValue_False.snap | 9 ++-- ...ties_False_OverrideOptionalValue_True.snap | 9 ++-- ...ties_True_OverrideOptionalValue_False.snap | 9 ++-- ...rties_True_OverrideOptionalValue_True.snap | 9 ++-- ...ies_False_OverrideOptionalValue_False.snap | 9 ++-- ...ties_False_OverrideOptionalValue_True.snap | 9 ++-- ...ties_True_OverrideOptionalValue_False.snap | 9 ++-- ...rties_True_OverrideOptionalValue_True.snap | 9 ++-- ...ies_False_OverrideOptionalValue_False.snap | 47 ++++++++++--------- ...ties_False_OverrideOptionalValue_True.snap | 47 ++++++++++--------- ...ties_True_OverrideOptionalValue_False.snap | 47 ++++++++++--------- ...rties_True_OverrideOptionalValue_True.snap | 47 ++++++++++--------- ...ies_False_OverrideOptionalValue_False.snap | 47 ++++++++++--------- ...ties_False_OverrideOptionalValue_True.snap | 47 ++++++++++--------- ...ties_True_OverrideOptionalValue_False.snap | 47 ++++++++++--------- ...rties_True_OverrideOptionalValue_True.snap | 47 ++++++++++--------- ...ies_False_OverrideOptionalValue_False.snap | 47 ++++++++++--------- ...ties_False_OverrideOptionalValue_True.snap | 47 ++++++++++--------- ...ties_True_OverrideOptionalValue_False.snap | 47 ++++++++++--------- ...rties_True_OverrideOptionalValue_True.snap | 47 ++++++++++--------- ...ies_False_OverrideOptionalValue_False.snap | 47 ++++++++++--------- ...ties_False_OverrideOptionalValue_True.snap | 47 ++++++++++--------- ...ties_True_OverrideOptionalValue_False.snap | 47 ++++++++++--------- ...rties_True_OverrideOptionalValue_True.snap | 47 ++++++++++--------- ...ies_False_OverrideOptionalValue_False.snap | 47 ++++++++++--------- ...ties_False_OverrideOptionalValue_True.snap | 47 ++++++++++--------- ...ties_True_OverrideOptionalValue_False.snap | 47 ++++++++++--------- ...rties_True_OverrideOptionalValue_True.snap | 47 ++++++++++--------- ...ies_False_OverrideOptionalValue_False.snap | 47 ++++++++++--------- ...ties_False_OverrideOptionalValue_True.snap | 47 ++++++++++--------- ...ties_True_OverrideOptionalValue_False.snap | 47 ++++++++++--------- ...rties_True_OverrideOptionalValue_True.snap | 47 ++++++++++--------- ...ies_False_OverrideOptionalValue_False.snap | 47 ++++++++++--------- ...ties_False_OverrideOptionalValue_True.snap | 47 ++++++++++--------- ...ties_True_OverrideOptionalValue_False.snap | 47 ++++++++++--------- ...rties_True_OverrideOptionalValue_True.snap | 47 ++++++++++--------- ...ies_False_OverrideOptionalValue_False.snap | 47 ++++++++++--------- ...ties_False_OverrideOptionalValue_True.snap | 47 ++++++++++--------- ...ties_True_OverrideOptionalValue_False.snap | 47 ++++++++++--------- ...rties_True_OverrideOptionalValue_True.snap | 47 ++++++++++--------- 161 files changed, 2056 insertions(+), 1538 deletions(-) diff --git a/src/ClientGenerator/RoslynTypeResolver.cs b/src/ClientGenerator/RoslynTypeResolver.cs index d42d548a..30438de4 100644 --- a/src/ClientGenerator/RoslynTypeResolver.cs +++ b/src/ClientGenerator/RoslynTypeResolver.cs @@ -11,9 +11,8 @@ using EdjCase.ICP.Candid.Models.Values; using System.Threading.Tasks; using EdjCase.ICP.Candid; -using Org.BouncyCastle.Asn1.Cms; using EdjCase.ICP.Candid.Models.Types; -using System.Security.Principal; +using EdjCase.ICP.Agent.Identities; namespace EdjCase.ICP.ClientGenerator { @@ -1433,6 +1432,19 @@ private StatementSyntax GenerateQueryCall(string methodName, string argName, str SyntaxFactory.Token(SyntaxKind.CommaToken), SyntaxFactory.Argument( SyntaxFactory.IdentifierName(argName) + ), + SyntaxFactory.Token(SyntaxKind.CommaToken), + SyntaxFactory.Argument( + SyntaxFactory.MemberAccessExpression( + SyntaxKind.SimpleMemberAccessExpression, + SyntaxFactory.ThisExpression(), + SyntaxFactory.IdentifierName("Identity") + ) + ) + .WithNameColon( + SyntaxFactory.NameColon( + SyntaxFactory.IdentifierName("identity") + ) ) } ) @@ -1480,6 +1492,19 @@ private StatementSyntax GenerateCallAndWait(string methodName, string argName, s SyntaxFactory.Token(SyntaxKind.CommaToken), SyntaxFactory.Argument( SyntaxFactory.IdentifierName(argName) + ), + SyntaxFactory.Token(SyntaxKind.CommaToken), + SyntaxFactory.Argument( + SyntaxFactory.MemberAccessExpression( + SyntaxKind.SimpleMemberAccessExpression, + SyntaxFactory.ThisExpression(), + SyntaxFactory.IdentifierName("Identity") + ) + ) + .WithNameColon( + SyntaxFactory.NameColon( + SyntaxFactory.IdentifierName("identity") + ) ) } ) @@ -1547,6 +1572,19 @@ private StatementSyntax GenerateCall(string methodName, string argName) SyntaxFactory.Token(SyntaxKind.CommaToken), SyntaxFactory.Argument( SyntaxFactory.IdentifierName(argName) + ), + SyntaxFactory.Token(SyntaxKind.CommaToken), + SyntaxFactory.Argument( + SyntaxFactory.MemberAccessExpression( + SyntaxKind.SimpleMemberAccessExpression, + SyntaxFactory.ThisExpression(), + SyntaxFactory.IdentifierName("Identity") + ) + ) + .WithNameColon( + SyntaxFactory.NameColon( + SyntaxFactory.IdentifierName("identity") + ) ) } ) diff --git a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap index 4780631b..48d49a50 100644 --- a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using System.Collections.Generic; @@ -10,26 +11,28 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity Identity { get; set; } public CandidConverter Converter { get; } - public AnonymousTuplesApiClient(IAgent agent, Principal canisterId, CandidConverter converter = default) + public AnonymousTuplesApiClient(IAgent agent, Principal canisterId, IIdentity identity = default, CandidConverter converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task>> A() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg, identity: this.Identity); return reply.ToObjects>>(this.Converter); } public async Task> B() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "b", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "b", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap index 4780631b..48d49a50 100644 --- a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using System.Collections.Generic; @@ -10,26 +11,28 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity Identity { get; set; } public CandidConverter Converter { get; } - public AnonymousTuplesApiClient(IAgent agent, Principal canisterId, CandidConverter converter = default) + public AnonymousTuplesApiClient(IAgent agent, Principal canisterId, IIdentity identity = default, CandidConverter converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task>> A() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg, identity: this.Identity); return reply.ToObjects>>(this.Converter); } public async Task> B() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "b", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "b", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap index 4780631b..48d49a50 100644 --- a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using System.Collections.Generic; @@ -10,26 +11,28 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity Identity { get; set; } public CandidConverter Converter { get; } - public AnonymousTuplesApiClient(IAgent agent, Principal canisterId, CandidConverter converter = default) + public AnonymousTuplesApiClient(IAgent agent, Principal canisterId, IIdentity identity = default, CandidConverter converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task>> A() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg, identity: this.Identity); return reply.ToObjects>>(this.Converter); } public async Task> B() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "b", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "b", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap index 4780631b..48d49a50 100644 --- a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using System.Collections.Generic; @@ -10,26 +11,28 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity Identity { get; set; } public CandidConverter Converter { get; } - public AnonymousTuplesApiClient(IAgent agent, Principal canisterId, CandidConverter converter = default) + public AnonymousTuplesApiClient(IAgent agent, Principal canisterId, IIdentity identity = default, CandidConverter converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task>> A() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg, identity: this.Identity); return reply.ToObjects>>(this.Converter); } public async Task> B() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "b", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "b", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap index 3cd9fde2..c1f751fd 100644 --- a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using System.Collections.Generic; @@ -10,26 +11,28 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity Identity { get; set; } public CandidConverter Converter { get; } - public AnonymousTuplesApiClient(IAgent agent, Principal canisterId, CandidConverter converter = default) + public AnonymousTuplesApiClient(IAgent agent, Principal canisterId, IIdentity identity = default, CandidConverter converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task>> a() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg, identity: this.Identity); return reply.ToObjects>>(this.Converter); } public async Task> b() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "b", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "b", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap index 3cd9fde2..c1f751fd 100644 --- a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using System.Collections.Generic; @@ -10,26 +11,28 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity Identity { get; set; } public CandidConverter Converter { get; } - public AnonymousTuplesApiClient(IAgent agent, Principal canisterId, CandidConverter converter = default) + public AnonymousTuplesApiClient(IAgent agent, Principal canisterId, IIdentity identity = default, CandidConverter converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task>> a() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg, identity: this.Identity); return reply.ToObjects>>(this.Converter); } public async Task> b() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "b", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "b", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap index 3cd9fde2..c1f751fd 100644 --- a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using System.Collections.Generic; @@ -10,26 +11,28 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity Identity { get; set; } public CandidConverter Converter { get; } - public AnonymousTuplesApiClient(IAgent agent, Principal canisterId, CandidConverter converter = default) + public AnonymousTuplesApiClient(IAgent agent, Principal canisterId, IIdentity identity = default, CandidConverter converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task>> a() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg, identity: this.Identity); return reply.ToObjects>>(this.Converter); } public async Task> b() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "b", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "b", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap index 3cd9fde2..c1f751fd 100644 --- a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using System.Collections.Generic; @@ -10,26 +11,28 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity Identity { get; set; } public CandidConverter Converter { get; } - public AnonymousTuplesApiClient(IAgent agent, Principal canisterId, CandidConverter converter = default) + public AnonymousTuplesApiClient(IAgent agent, Principal canisterId, IIdentity identity = default, CandidConverter converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task>> a() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg, identity: this.Identity); return reply.ToObjects>>(this.Converter); } public async Task> b() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "b", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "b", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap index 17531654..85083975 100644 --- a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using System.Collections.Generic; @@ -10,26 +11,28 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity? Identity { get; set; } public CandidConverter? Converter { get; } - public AnonymousTuplesApiClient(IAgent agent, Principal canisterId, CandidConverter? converter = default) + public AnonymousTuplesApiClient(IAgent agent, Principal canisterId, IIdentity? identity = default, CandidConverter? converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task>> A() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg, identity: this.Identity); return reply.ToObjects>>(this.Converter); } public async Task> B() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "b", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "b", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap index 17531654..85083975 100644 --- a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using System.Collections.Generic; @@ -10,26 +11,28 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity? Identity { get; set; } public CandidConverter? Converter { get; } - public AnonymousTuplesApiClient(IAgent agent, Principal canisterId, CandidConverter? converter = default) + public AnonymousTuplesApiClient(IAgent agent, Principal canisterId, IIdentity? identity = default, CandidConverter? converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task>> A() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg, identity: this.Identity); return reply.ToObjects>>(this.Converter); } public async Task> B() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "b", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "b", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap index 17531654..85083975 100644 --- a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using System.Collections.Generic; @@ -10,26 +11,28 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity? Identity { get; set; } public CandidConverter? Converter { get; } - public AnonymousTuplesApiClient(IAgent agent, Principal canisterId, CandidConverter? converter = default) + public AnonymousTuplesApiClient(IAgent agent, Principal canisterId, IIdentity? identity = default, CandidConverter? converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task>> A() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg, identity: this.Identity); return reply.ToObjects>>(this.Converter); } public async Task> B() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "b", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "b", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap index 17531654..85083975 100644 --- a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using System.Collections.Generic; @@ -10,26 +11,28 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity? Identity { get; set; } public CandidConverter? Converter { get; } - public AnonymousTuplesApiClient(IAgent agent, Principal canisterId, CandidConverter? converter = default) + public AnonymousTuplesApiClient(IAgent agent, Principal canisterId, IIdentity? identity = default, CandidConverter? converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task>> A() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg, identity: this.Identity); return reply.ToObjects>>(this.Converter); } public async Task> B() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "b", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "b", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap index ec4731bf..22b113d2 100644 --- a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using System.Collections.Generic; @@ -10,26 +11,28 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity? Identity { get; set; } public CandidConverter? Converter { get; } - public AnonymousTuplesApiClient(IAgent agent, Principal canisterId, CandidConverter? converter = default) + public AnonymousTuplesApiClient(IAgent agent, Principal canisterId, IIdentity? identity = default, CandidConverter? converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task>> a() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg, identity: this.Identity); return reply.ToObjects>>(this.Converter); } public async Task> b() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "b", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "b", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap index ec4731bf..22b113d2 100644 --- a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using System.Collections.Generic; @@ -10,26 +11,28 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity? Identity { get; set; } public CandidConverter? Converter { get; } - public AnonymousTuplesApiClient(IAgent agent, Principal canisterId, CandidConverter? converter = default) + public AnonymousTuplesApiClient(IAgent agent, Principal canisterId, IIdentity? identity = default, CandidConverter? converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task>> a() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg, identity: this.Identity); return reply.ToObjects>>(this.Converter); } public async Task> b() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "b", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "b", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap index ec4731bf..22b113d2 100644 --- a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using System.Collections.Generic; @@ -10,26 +11,28 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity? Identity { get; set; } public CandidConverter? Converter { get; } - public AnonymousTuplesApiClient(IAgent agent, Principal canisterId, CandidConverter? converter = default) + public AnonymousTuplesApiClient(IAgent agent, Principal canisterId, IIdentity? identity = default, CandidConverter? converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task>> a() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg, identity: this.Identity); return reply.ToObjects>>(this.Converter); } public async Task> b() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "b", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "b", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap index ec4731bf..22b113d2 100644 --- a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using System.Collections.Generic; @@ -10,26 +11,28 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity? Identity { get; set; } public CandidConverter? Converter { get; } - public AnonymousTuplesApiClient(IAgent agent, Principal canisterId, CandidConverter? converter = default) + public AnonymousTuplesApiClient(IAgent agent, Principal canisterId, IIdentity? identity = default, CandidConverter? converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task>> a() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg, identity: this.Identity); return reply.ToObjects>>(this.Converter); } public async Task> b() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "b", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "b", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap index 4780631b..48d49a50 100644 --- a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using System.Collections.Generic; @@ -10,26 +11,28 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity Identity { get; set; } public CandidConverter Converter { get; } - public AnonymousTuplesApiClient(IAgent agent, Principal canisterId, CandidConverter converter = default) + public AnonymousTuplesApiClient(IAgent agent, Principal canisterId, IIdentity identity = default, CandidConverter converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task>> A() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg, identity: this.Identity); return reply.ToObjects>>(this.Converter); } public async Task> B() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "b", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "b", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap index 4780631b..48d49a50 100644 --- a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using System.Collections.Generic; @@ -10,26 +11,28 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity Identity { get; set; } public CandidConverter Converter { get; } - public AnonymousTuplesApiClient(IAgent agent, Principal canisterId, CandidConverter converter = default) + public AnonymousTuplesApiClient(IAgent agent, Principal canisterId, IIdentity identity = default, CandidConverter converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task>> A() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg, identity: this.Identity); return reply.ToObjects>>(this.Converter); } public async Task> B() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "b", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "b", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap index 4780631b..48d49a50 100644 --- a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using System.Collections.Generic; @@ -10,26 +11,28 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity Identity { get; set; } public CandidConverter Converter { get; } - public AnonymousTuplesApiClient(IAgent agent, Principal canisterId, CandidConverter converter = default) + public AnonymousTuplesApiClient(IAgent agent, Principal canisterId, IIdentity identity = default, CandidConverter converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task>> A() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg, identity: this.Identity); return reply.ToObjects>>(this.Converter); } public async Task> B() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "b", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "b", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap index 4780631b..48d49a50 100644 --- a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using System.Collections.Generic; @@ -10,26 +11,28 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity Identity { get; set; } public CandidConverter Converter { get; } - public AnonymousTuplesApiClient(IAgent agent, Principal canisterId, CandidConverter converter = default) + public AnonymousTuplesApiClient(IAgent agent, Principal canisterId, IIdentity identity = default, CandidConverter converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task>> A() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg, identity: this.Identity); return reply.ToObjects>>(this.Converter); } public async Task> B() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "b", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "b", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap index 3cd9fde2..c1f751fd 100644 --- a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using System.Collections.Generic; @@ -10,26 +11,28 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity Identity { get; set; } public CandidConverter Converter { get; } - public AnonymousTuplesApiClient(IAgent agent, Principal canisterId, CandidConverter converter = default) + public AnonymousTuplesApiClient(IAgent agent, Principal canisterId, IIdentity identity = default, CandidConverter converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task>> a() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg, identity: this.Identity); return reply.ToObjects>>(this.Converter); } public async Task> b() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "b", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "b", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap index 3cd9fde2..c1f751fd 100644 --- a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using System.Collections.Generic; @@ -10,26 +11,28 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity Identity { get; set; } public CandidConverter Converter { get; } - public AnonymousTuplesApiClient(IAgent agent, Principal canisterId, CandidConverter converter = default) + public AnonymousTuplesApiClient(IAgent agent, Principal canisterId, IIdentity identity = default, CandidConverter converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task>> a() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg, identity: this.Identity); return reply.ToObjects>>(this.Converter); } public async Task> b() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "b", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "b", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap index 3cd9fde2..c1f751fd 100644 --- a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using System.Collections.Generic; @@ -10,26 +11,28 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity Identity { get; set; } public CandidConverter Converter { get; } - public AnonymousTuplesApiClient(IAgent agent, Principal canisterId, CandidConverter converter = default) + public AnonymousTuplesApiClient(IAgent agent, Principal canisterId, IIdentity identity = default, CandidConverter converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task>> a() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg, identity: this.Identity); return reply.ToObjects>>(this.Converter); } public async Task> b() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "b", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "b", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap index 3cd9fde2..c1f751fd 100644 --- a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using System.Collections.Generic; @@ -10,26 +11,28 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity Identity { get; set; } public CandidConverter Converter { get; } - public AnonymousTuplesApiClient(IAgent agent, Principal canisterId, CandidConverter converter = default) + public AnonymousTuplesApiClient(IAgent agent, Principal canisterId, IIdentity identity = default, CandidConverter converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task>> a() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg, identity: this.Identity); return reply.ToObjects>>(this.Converter); } public async Task> b() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "b", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "b", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap index 17531654..85083975 100644 --- a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using System.Collections.Generic; @@ -10,26 +11,28 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity? Identity { get; set; } public CandidConverter? Converter { get; } - public AnonymousTuplesApiClient(IAgent agent, Principal canisterId, CandidConverter? converter = default) + public AnonymousTuplesApiClient(IAgent agent, Principal canisterId, IIdentity? identity = default, CandidConverter? converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task>> A() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg, identity: this.Identity); return reply.ToObjects>>(this.Converter); } public async Task> B() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "b", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "b", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap index 17531654..85083975 100644 --- a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using System.Collections.Generic; @@ -10,26 +11,28 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity? Identity { get; set; } public CandidConverter? Converter { get; } - public AnonymousTuplesApiClient(IAgent agent, Principal canisterId, CandidConverter? converter = default) + public AnonymousTuplesApiClient(IAgent agent, Principal canisterId, IIdentity? identity = default, CandidConverter? converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task>> A() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg, identity: this.Identity); return reply.ToObjects>>(this.Converter); } public async Task> B() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "b", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "b", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap index 17531654..85083975 100644 --- a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using System.Collections.Generic; @@ -10,26 +11,28 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity? Identity { get; set; } public CandidConverter? Converter { get; } - public AnonymousTuplesApiClient(IAgent agent, Principal canisterId, CandidConverter? converter = default) + public AnonymousTuplesApiClient(IAgent agent, Principal canisterId, IIdentity? identity = default, CandidConverter? converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task>> A() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg, identity: this.Identity); return reply.ToObjects>>(this.Converter); } public async Task> B() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "b", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "b", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap index 17531654..85083975 100644 --- a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using System.Collections.Generic; @@ -10,26 +11,28 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity? Identity { get; set; } public CandidConverter? Converter { get; } - public AnonymousTuplesApiClient(IAgent agent, Principal canisterId, CandidConverter? converter = default) + public AnonymousTuplesApiClient(IAgent agent, Principal canisterId, IIdentity? identity = default, CandidConverter? converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task>> A() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg, identity: this.Identity); return reply.ToObjects>>(this.Converter); } public async Task> B() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "b", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "b", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap index ec4731bf..22b113d2 100644 --- a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using System.Collections.Generic; @@ -10,26 +11,28 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity? Identity { get; set; } public CandidConverter? Converter { get; } - public AnonymousTuplesApiClient(IAgent agent, Principal canisterId, CandidConverter? converter = default) + public AnonymousTuplesApiClient(IAgent agent, Principal canisterId, IIdentity? identity = default, CandidConverter? converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task>> a() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg, identity: this.Identity); return reply.ToObjects>>(this.Converter); } public async Task> b() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "b", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "b", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap index ec4731bf..22b113d2 100644 --- a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using System.Collections.Generic; @@ -10,26 +11,28 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity? Identity { get; set; } public CandidConverter? Converter { get; } - public AnonymousTuplesApiClient(IAgent agent, Principal canisterId, CandidConverter? converter = default) + public AnonymousTuplesApiClient(IAgent agent, Principal canisterId, IIdentity? identity = default, CandidConverter? converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task>> a() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg, identity: this.Identity); return reply.ToObjects>>(this.Converter); } public async Task> b() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "b", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "b", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap index ec4731bf..22b113d2 100644 --- a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using System.Collections.Generic; @@ -10,26 +11,28 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity? Identity { get; set; } public CandidConverter? Converter { get; } - public AnonymousTuplesApiClient(IAgent agent, Principal canisterId, CandidConverter? converter = default) + public AnonymousTuplesApiClient(IAgent agent, Principal canisterId, IIdentity? identity = default, CandidConverter? converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task>> a() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg, identity: this.Identity); return reply.ToObjects>>(this.Converter); } public async Task> b() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "b", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "b", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap index ec4731bf..22b113d2 100644 --- a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using System.Collections.Generic; @@ -10,26 +11,28 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity? Identity { get; set; } public CandidConverter? Converter { get; } - public AnonymousTuplesApiClient(IAgent agent, Principal canisterId, CandidConverter? converter = default) + public AnonymousTuplesApiClient(IAgent agent, Principal canisterId, IIdentity? identity = default, CandidConverter? converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task>> a() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg, identity: this.Identity); return reply.ToObjects>>(this.Converter); } public async Task> b() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "b", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "b", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap index 19e0cc14..95863307 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; @@ -13,108 +14,110 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity Identity { get; set; } public CandidConverter Converter { get; } - public DexApiClient(IAgent agent, Principal canisterId, CandidConverter converter = default) + public DexApiClient(IAgent agent, Principal canisterId, IIdentity identity = default, CandidConverter converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task CancelOrder(OrderId arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "cancelOrder", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "cancelOrder", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task Clear() { CandidArg arg = CandidArg.FromCandid(); - await this.Agent.CallAsync(this.CanisterId, "clear", arg); + await this.Agent.CallAsync(this.CanisterId, "clear", arg, identity: this.Identity); } public async Task Credit(Principal arg0, Token arg1, UnboundedUInt arg2) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter), CandidTypedValue.FromObject(arg2, this.Converter)); - await this.Agent.CallAsync(this.CanisterId, "credit", arg); + await this.Agent.CallAsync(this.CanisterId, "credit", arg, identity: this.Identity); } public async Task Deposit(Token arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "deposit", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "deposit", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task> GetAllBalances() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getAllBalances", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getAllBalances", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task GetBalance(Token arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalance", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalance", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task> GetBalances() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalances", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalances", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task> GetDepositAddress() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getDepositAddress", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getDepositAddress", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task> GetOrder(OrderId arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getOrder", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getOrder", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task> GetOrders() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getOrders", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getOrders", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task GetSymbol(Token arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getSymbol", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getSymbol", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task PlaceOrder(Token arg0, UnboundedUInt arg1, Token arg2, UnboundedUInt arg3) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter), CandidTypedValue.FromObject(arg2, this.Converter), CandidTypedValue.FromObject(arg3, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "placeOrder", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "placeOrder", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task Whoami() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "whoami", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "whoami", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task Withdraw(Token arg0, UnboundedUInt arg1, Principal arg2) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter), CandidTypedValue.FromObject(arg2, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "withdraw", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "withdraw", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap index ad4c3ff5..20ee937d 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; @@ -13,108 +14,110 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity Identity { get; set; } public CandidConverter Converter { get; } - public DexApiClient(IAgent agent, Principal canisterId, CandidConverter converter = default) + public DexApiClient(IAgent agent, Principal canisterId, IIdentity identity = default, CandidConverter converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task CancelOrder(OrderId arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "cancelOrder", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "cancelOrder", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task Clear() { CandidArg arg = CandidArg.FromCandid(); - await this.Agent.CallAsync(this.CanisterId, "clear", arg); + await this.Agent.CallAsync(this.CanisterId, "clear", arg, identity: this.Identity); } public async Task Credit(Principal arg0, Token arg1, UnboundedUInt arg2) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter), CandidTypedValue.FromObject(arg2, this.Converter)); - await this.Agent.CallAsync(this.CanisterId, "credit", arg); + await this.Agent.CallAsync(this.CanisterId, "credit", arg, identity: this.Identity); } public async Task Deposit(Token arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "deposit", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "deposit", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task> GetAllBalances() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getAllBalances", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getAllBalances", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task GetBalance(Token arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalance", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalance", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task> GetBalances() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalances", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalances", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task> GetDepositAddress() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getDepositAddress", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getDepositAddress", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task> GetOrder(OrderId arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getOrder", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getOrder", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task> GetOrders() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getOrders", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getOrders", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task GetSymbol(Token arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getSymbol", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getSymbol", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task PlaceOrder(Token arg0, UnboundedUInt arg1, Token arg2, UnboundedUInt arg3) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter), CandidTypedValue.FromObject(arg2, this.Converter), CandidTypedValue.FromObject(arg3, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "placeOrder", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "placeOrder", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task Whoami() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "whoami", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "whoami", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task Withdraw(Token arg0, UnboundedUInt arg1, Principal arg2) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter), CandidTypedValue.FromObject(arg2, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "withdraw", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "withdraw", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap index 24a1cb9a..6b94dfad 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; @@ -13,108 +14,110 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity Identity { get; set; } public CandidConverter Converter { get; } - public DexApiClient(IAgent agent, Principal canisterId, CandidConverter converter = default) + public DexApiClient(IAgent agent, Principal canisterId, IIdentity identity = default, CandidConverter converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task CancelOrder(OrderId arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "cancelOrder", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "cancelOrder", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task Clear() { CandidArg arg = CandidArg.FromCandid(); - await this.Agent.CallAsync(this.CanisterId, "clear", arg); + await this.Agent.CallAsync(this.CanisterId, "clear", arg, identity: this.Identity); } public async Task Credit(Principal arg0, Token arg1, UnboundedUInt arg2) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter), CandidTypedValue.FromObject(arg2, this.Converter)); - await this.Agent.CallAsync(this.CanisterId, "credit", arg); + await this.Agent.CallAsync(this.CanisterId, "credit", arg, identity: this.Identity); } public async Task Deposit(Token arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "deposit", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "deposit", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task> GetAllBalances() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getAllBalances", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getAllBalances", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task GetBalance(Token arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalance", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalance", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task> GetBalances() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalances", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalances", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task> GetDepositAddress() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getDepositAddress", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getDepositAddress", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task> GetOrder(OrderId arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getOrder", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getOrder", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task> GetOrders() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getOrders", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getOrders", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task GetSymbol(Token arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getSymbol", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getSymbol", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task PlaceOrder(Token arg0, UnboundedUInt arg1, Token arg2, UnboundedUInt arg3) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter), CandidTypedValue.FromObject(arg2, this.Converter), CandidTypedValue.FromObject(arg3, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "placeOrder", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "placeOrder", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task Whoami() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "whoami", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "whoami", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task Withdraw(Token arg0, UnboundedUInt arg1, Principal arg2) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter), CandidTypedValue.FromObject(arg2, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "withdraw", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "withdraw", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap index f3945901..68a6ae86 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; @@ -13,108 +14,110 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity Identity { get; set; } public CandidConverter Converter { get; } - public DexApiClient(IAgent agent, Principal canisterId, CandidConverter converter = default) + public DexApiClient(IAgent agent, Principal canisterId, IIdentity identity = default, CandidConverter converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task CancelOrder(OrderId arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "cancelOrder", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "cancelOrder", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task Clear() { CandidArg arg = CandidArg.FromCandid(); - await this.Agent.CallAsync(this.CanisterId, "clear", arg); + await this.Agent.CallAsync(this.CanisterId, "clear", arg, identity: this.Identity); } public async Task Credit(Principal arg0, Token arg1, UnboundedUInt arg2) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter), CandidTypedValue.FromObject(arg2, this.Converter)); - await this.Agent.CallAsync(this.CanisterId, "credit", arg); + await this.Agent.CallAsync(this.CanisterId, "credit", arg, identity: this.Identity); } public async Task Deposit(Token arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "deposit", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "deposit", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task> GetAllBalances() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getAllBalances", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getAllBalances", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task GetBalance(Token arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalance", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalance", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task> GetBalances() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalances", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalances", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task> GetDepositAddress() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getDepositAddress", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getDepositAddress", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task> GetOrder(OrderId arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getOrder", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getOrder", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task> GetOrders() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getOrders", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getOrders", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task GetSymbol(Token arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getSymbol", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getSymbol", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task PlaceOrder(Token arg0, UnboundedUInt arg1, Token arg2, UnboundedUInt arg3) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter), CandidTypedValue.FromObject(arg2, this.Converter), CandidTypedValue.FromObject(arg3, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "placeOrder", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "placeOrder", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task Whoami() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "whoami", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "whoami", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task Withdraw(Token arg0, UnboundedUInt arg1, Principal arg2) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter), CandidTypedValue.FromObject(arg2, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "withdraw", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "withdraw", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap index de16ae42..8ab3be53 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; @@ -13,108 +14,110 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity Identity { get; set; } public CandidConverter Converter { get; } - public DexApiClient(IAgent agent, Principal canisterId, CandidConverter converter = default) + public DexApiClient(IAgent agent, Principal canisterId, IIdentity identity = default, CandidConverter converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task cancelOrder(OrderId arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "cancelOrder", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "cancelOrder", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task clear() { CandidArg arg = CandidArg.FromCandid(); - await this.Agent.CallAsync(this.CanisterId, "clear", arg); + await this.Agent.CallAsync(this.CanisterId, "clear", arg, identity: this.Identity); } public async Task credit(Principal arg0, Token arg1, UnboundedUInt arg2) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter), CandidTypedValue.FromObject(arg2, this.Converter)); - await this.Agent.CallAsync(this.CanisterId, "credit", arg); + await this.Agent.CallAsync(this.CanisterId, "credit", arg, identity: this.Identity); } public async Task deposit(Token arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "deposit", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "deposit", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task> getAllBalances() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getAllBalances", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getAllBalances", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task getBalance(Token arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalance", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalance", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task> getBalances() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalances", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalances", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task> getDepositAddress() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getDepositAddress", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getDepositAddress", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task> getOrder(OrderId arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getOrder", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getOrder", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task> getOrders() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getOrders", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getOrders", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task getSymbol(Token arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getSymbol", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getSymbol", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task placeOrder(Token arg0, UnboundedUInt arg1, Token arg2, UnboundedUInt arg3) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter), CandidTypedValue.FromObject(arg2, this.Converter), CandidTypedValue.FromObject(arg3, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "placeOrder", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "placeOrder", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task whoami() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "whoami", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "whoami", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task withdraw(Token arg0, UnboundedUInt arg1, Principal arg2) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter), CandidTypedValue.FromObject(arg2, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "withdraw", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "withdraw", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap index 84b66e9a..3608e278 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; @@ -13,108 +14,110 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity Identity { get; set; } public CandidConverter Converter { get; } - public DexApiClient(IAgent agent, Principal canisterId, CandidConverter converter = default) + public DexApiClient(IAgent agent, Principal canisterId, IIdentity identity = default, CandidConverter converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task cancelOrder(OrderId arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "cancelOrder", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "cancelOrder", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task clear() { CandidArg arg = CandidArg.FromCandid(); - await this.Agent.CallAsync(this.CanisterId, "clear", arg); + await this.Agent.CallAsync(this.CanisterId, "clear", arg, identity: this.Identity); } public async Task credit(Principal arg0, Token arg1, UnboundedUInt arg2) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter), CandidTypedValue.FromObject(arg2, this.Converter)); - await this.Agent.CallAsync(this.CanisterId, "credit", arg); + await this.Agent.CallAsync(this.CanisterId, "credit", arg, identity: this.Identity); } public async Task deposit(Token arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "deposit", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "deposit", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task> getAllBalances() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getAllBalances", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getAllBalances", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task getBalance(Token arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalance", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalance", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task> getBalances() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalances", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalances", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task> getDepositAddress() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getDepositAddress", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getDepositAddress", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task> getOrder(OrderId arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getOrder", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getOrder", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task> getOrders() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getOrders", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getOrders", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task getSymbol(Token arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getSymbol", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getSymbol", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task placeOrder(Token arg0, UnboundedUInt arg1, Token arg2, UnboundedUInt arg3) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter), CandidTypedValue.FromObject(arg2, this.Converter), CandidTypedValue.FromObject(arg3, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "placeOrder", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "placeOrder", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task whoami() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "whoami", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "whoami", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task withdraw(Token arg0, UnboundedUInt arg1, Principal arg2) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter), CandidTypedValue.FromObject(arg2, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "withdraw", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "withdraw", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap index f9583274..65a69ec0 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; @@ -13,108 +14,110 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity Identity { get; set; } public CandidConverter Converter { get; } - public DexApiClient(IAgent agent, Principal canisterId, CandidConverter converter = default) + public DexApiClient(IAgent agent, Principal canisterId, IIdentity identity = default, CandidConverter converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task cancelOrder(OrderId arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "cancelOrder", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "cancelOrder", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task clear() { CandidArg arg = CandidArg.FromCandid(); - await this.Agent.CallAsync(this.CanisterId, "clear", arg); + await this.Agent.CallAsync(this.CanisterId, "clear", arg, identity: this.Identity); } public async Task credit(Principal arg0, Token arg1, UnboundedUInt arg2) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter), CandidTypedValue.FromObject(arg2, this.Converter)); - await this.Agent.CallAsync(this.CanisterId, "credit", arg); + await this.Agent.CallAsync(this.CanisterId, "credit", arg, identity: this.Identity); } public async Task deposit(Token arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "deposit", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "deposit", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task> getAllBalances() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getAllBalances", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getAllBalances", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task getBalance(Token arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalance", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalance", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task> getBalances() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalances", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalances", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task> getDepositAddress() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getDepositAddress", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getDepositAddress", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task> getOrder(OrderId arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getOrder", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getOrder", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task> getOrders() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getOrders", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getOrders", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task getSymbol(Token arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getSymbol", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getSymbol", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task placeOrder(Token arg0, UnboundedUInt arg1, Token arg2, UnboundedUInt arg3) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter), CandidTypedValue.FromObject(arg2, this.Converter), CandidTypedValue.FromObject(arg3, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "placeOrder", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "placeOrder", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task whoami() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "whoami", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "whoami", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task withdraw(Token arg0, UnboundedUInt arg1, Principal arg2) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter), CandidTypedValue.FromObject(arg2, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "withdraw", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "withdraw", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap index 0645c951..ab7a9da1 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; @@ -13,108 +14,110 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity Identity { get; set; } public CandidConverter Converter { get; } - public DexApiClient(IAgent agent, Principal canisterId, CandidConverter converter = default) + public DexApiClient(IAgent agent, Principal canisterId, IIdentity identity = default, CandidConverter converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task cancelOrder(OrderId arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "cancelOrder", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "cancelOrder", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task clear() { CandidArg arg = CandidArg.FromCandid(); - await this.Agent.CallAsync(this.CanisterId, "clear", arg); + await this.Agent.CallAsync(this.CanisterId, "clear", arg, identity: this.Identity); } public async Task credit(Principal arg0, Token arg1, UnboundedUInt arg2) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter), CandidTypedValue.FromObject(arg2, this.Converter)); - await this.Agent.CallAsync(this.CanisterId, "credit", arg); + await this.Agent.CallAsync(this.CanisterId, "credit", arg, identity: this.Identity); } public async Task deposit(Token arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "deposit", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "deposit", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task> getAllBalances() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getAllBalances", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getAllBalances", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task getBalance(Token arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalance", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalance", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task> getBalances() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalances", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalances", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task> getDepositAddress() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getDepositAddress", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getDepositAddress", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task> getOrder(OrderId arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getOrder", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getOrder", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task> getOrders() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getOrders", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getOrders", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task getSymbol(Token arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getSymbol", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getSymbol", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task placeOrder(Token arg0, UnboundedUInt arg1, Token arg2, UnboundedUInt arg3) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter), CandidTypedValue.FromObject(arg2, this.Converter), CandidTypedValue.FromObject(arg3, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "placeOrder", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "placeOrder", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task whoami() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "whoami", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "whoami", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task withdraw(Token arg0, UnboundedUInt arg1, Principal arg2) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter), CandidTypedValue.FromObject(arg2, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "withdraw", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "withdraw", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap index a4432db3..39f9c55e 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; @@ -13,108 +14,110 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity? Identity { get; set; } public CandidConverter? Converter { get; } - public DexApiClient(IAgent agent, Principal canisterId, CandidConverter? converter = default) + public DexApiClient(IAgent agent, Principal canisterId, IIdentity? identity = default, CandidConverter? converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task CancelOrder(OrderId arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "cancelOrder", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "cancelOrder", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task Clear() { CandidArg arg = CandidArg.FromCandid(); - await this.Agent.CallAsync(this.CanisterId, "clear", arg); + await this.Agent.CallAsync(this.CanisterId, "clear", arg, identity: this.Identity); } public async Task Credit(Principal arg0, Token arg1, UnboundedUInt arg2) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter), CandidTypedValue.FromObject(arg2, this.Converter)); - await this.Agent.CallAsync(this.CanisterId, "credit", arg); + await this.Agent.CallAsync(this.CanisterId, "credit", arg, identity: this.Identity); } public async Task Deposit(Token arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "deposit", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "deposit", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task> GetAllBalances() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getAllBalances", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getAllBalances", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task GetBalance(Token arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalance", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalance", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task> GetBalances() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalances", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalances", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task> GetDepositAddress() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getDepositAddress", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getDepositAddress", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task> GetOrder(OrderId arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getOrder", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getOrder", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task> GetOrders() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getOrders", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getOrders", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task GetSymbol(Token arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getSymbol", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getSymbol", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task PlaceOrder(Token arg0, UnboundedUInt arg1, Token arg2, UnboundedUInt arg3) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter), CandidTypedValue.FromObject(arg2, this.Converter), CandidTypedValue.FromObject(arg3, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "placeOrder", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "placeOrder", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task Whoami() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "whoami", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "whoami", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task Withdraw(Token arg0, UnboundedUInt arg1, Principal arg2) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter), CandidTypedValue.FromObject(arg2, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "withdraw", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "withdraw", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap index b03b9327..7cd99f18 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; @@ -13,108 +14,110 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity? Identity { get; set; } public CandidConverter? Converter { get; } - public DexApiClient(IAgent agent, Principal canisterId, CandidConverter? converter = default) + public DexApiClient(IAgent agent, Principal canisterId, IIdentity? identity = default, CandidConverter? converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task CancelOrder(OrderId arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "cancelOrder", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "cancelOrder", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task Clear() { CandidArg arg = CandidArg.FromCandid(); - await this.Agent.CallAsync(this.CanisterId, "clear", arg); + await this.Agent.CallAsync(this.CanisterId, "clear", arg, identity: this.Identity); } public async Task Credit(Principal arg0, Token arg1, UnboundedUInt arg2) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter), CandidTypedValue.FromObject(arg2, this.Converter)); - await this.Agent.CallAsync(this.CanisterId, "credit", arg); + await this.Agent.CallAsync(this.CanisterId, "credit", arg, identity: this.Identity); } public async Task Deposit(Token arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "deposit", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "deposit", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task> GetAllBalances() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getAllBalances", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getAllBalances", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task GetBalance(Token arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalance", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalance", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task> GetBalances() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalances", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalances", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task> GetDepositAddress() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getDepositAddress", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getDepositAddress", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task> GetOrder(OrderId arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getOrder", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getOrder", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task> GetOrders() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getOrders", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getOrders", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task GetSymbol(Token arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getSymbol", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getSymbol", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task PlaceOrder(Token arg0, UnboundedUInt arg1, Token arg2, UnboundedUInt arg3) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter), CandidTypedValue.FromObject(arg2, this.Converter), CandidTypedValue.FromObject(arg3, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "placeOrder", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "placeOrder", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task Whoami() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "whoami", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "whoami", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task Withdraw(Token arg0, UnboundedUInt arg1, Principal arg2) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter), CandidTypedValue.FromObject(arg2, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "withdraw", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "withdraw", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap index efd2159a..6ac618c3 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; @@ -13,108 +14,110 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity? Identity { get; set; } public CandidConverter? Converter { get; } - public DexApiClient(IAgent agent, Principal canisterId, CandidConverter? converter = default) + public DexApiClient(IAgent agent, Principal canisterId, IIdentity? identity = default, CandidConverter? converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task CancelOrder(OrderId arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "cancelOrder", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "cancelOrder", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task Clear() { CandidArg arg = CandidArg.FromCandid(); - await this.Agent.CallAsync(this.CanisterId, "clear", arg); + await this.Agent.CallAsync(this.CanisterId, "clear", arg, identity: this.Identity); } public async Task Credit(Principal arg0, Token arg1, UnboundedUInt arg2) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter), CandidTypedValue.FromObject(arg2, this.Converter)); - await this.Agent.CallAsync(this.CanisterId, "credit", arg); + await this.Agent.CallAsync(this.CanisterId, "credit", arg, identity: this.Identity); } public async Task Deposit(Token arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "deposit", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "deposit", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task> GetAllBalances() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getAllBalances", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getAllBalances", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task GetBalance(Token arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalance", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalance", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task> GetBalances() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalances", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalances", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task> GetDepositAddress() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getDepositAddress", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getDepositAddress", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task> GetOrder(OrderId arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getOrder", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getOrder", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task> GetOrders() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getOrders", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getOrders", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task GetSymbol(Token arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getSymbol", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getSymbol", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task PlaceOrder(Token arg0, UnboundedUInt arg1, Token arg2, UnboundedUInt arg3) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter), CandidTypedValue.FromObject(arg2, this.Converter), CandidTypedValue.FromObject(arg3, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "placeOrder", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "placeOrder", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task Whoami() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "whoami", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "whoami", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task Withdraw(Token arg0, UnboundedUInt arg1, Principal arg2) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter), CandidTypedValue.FromObject(arg2, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "withdraw", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "withdraw", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap index 89395b5b..b5cf35c1 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; @@ -13,108 +14,110 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity? Identity { get; set; } public CandidConverter? Converter { get; } - public DexApiClient(IAgent agent, Principal canisterId, CandidConverter? converter = default) + public DexApiClient(IAgent agent, Principal canisterId, IIdentity? identity = default, CandidConverter? converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task CancelOrder(OrderId arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "cancelOrder", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "cancelOrder", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task Clear() { CandidArg arg = CandidArg.FromCandid(); - await this.Agent.CallAsync(this.CanisterId, "clear", arg); + await this.Agent.CallAsync(this.CanisterId, "clear", arg, identity: this.Identity); } public async Task Credit(Principal arg0, Token arg1, UnboundedUInt arg2) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter), CandidTypedValue.FromObject(arg2, this.Converter)); - await this.Agent.CallAsync(this.CanisterId, "credit", arg); + await this.Agent.CallAsync(this.CanisterId, "credit", arg, identity: this.Identity); } public async Task Deposit(Token arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "deposit", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "deposit", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task> GetAllBalances() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getAllBalances", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getAllBalances", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task GetBalance(Token arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalance", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalance", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task> GetBalances() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalances", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalances", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task> GetDepositAddress() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getDepositAddress", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getDepositAddress", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task> GetOrder(OrderId arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getOrder", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getOrder", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task> GetOrders() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getOrders", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getOrders", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task GetSymbol(Token arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getSymbol", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getSymbol", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task PlaceOrder(Token arg0, UnboundedUInt arg1, Token arg2, UnboundedUInt arg3) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter), CandidTypedValue.FromObject(arg2, this.Converter), CandidTypedValue.FromObject(arg3, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "placeOrder", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "placeOrder", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task Whoami() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "whoami", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "whoami", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task Withdraw(Token arg0, UnboundedUInt arg1, Principal arg2) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter), CandidTypedValue.FromObject(arg2, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "withdraw", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "withdraw", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap index 83a910ea..9a4f1d87 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; @@ -13,108 +14,110 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity? Identity { get; set; } public CandidConverter? Converter { get; } - public DexApiClient(IAgent agent, Principal canisterId, CandidConverter? converter = default) + public DexApiClient(IAgent agent, Principal canisterId, IIdentity? identity = default, CandidConverter? converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task cancelOrder(OrderId arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "cancelOrder", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "cancelOrder", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task clear() { CandidArg arg = CandidArg.FromCandid(); - await this.Agent.CallAsync(this.CanisterId, "clear", arg); + await this.Agent.CallAsync(this.CanisterId, "clear", arg, identity: this.Identity); } public async Task credit(Principal arg0, Token arg1, UnboundedUInt arg2) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter), CandidTypedValue.FromObject(arg2, this.Converter)); - await this.Agent.CallAsync(this.CanisterId, "credit", arg); + await this.Agent.CallAsync(this.CanisterId, "credit", arg, identity: this.Identity); } public async Task deposit(Token arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "deposit", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "deposit", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task> getAllBalances() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getAllBalances", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getAllBalances", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task getBalance(Token arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalance", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalance", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task> getBalances() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalances", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalances", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task> getDepositAddress() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getDepositAddress", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getDepositAddress", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task> getOrder(OrderId arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getOrder", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getOrder", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task> getOrders() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getOrders", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getOrders", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task getSymbol(Token arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getSymbol", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getSymbol", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task placeOrder(Token arg0, UnboundedUInt arg1, Token arg2, UnboundedUInt arg3) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter), CandidTypedValue.FromObject(arg2, this.Converter), CandidTypedValue.FromObject(arg3, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "placeOrder", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "placeOrder", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task whoami() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "whoami", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "whoami", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task withdraw(Token arg0, UnboundedUInt arg1, Principal arg2) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter), CandidTypedValue.FromObject(arg2, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "withdraw", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "withdraw", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap index ba0ab72f..08c6aaea 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; @@ -13,108 +14,110 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity? Identity { get; set; } public CandidConverter? Converter { get; } - public DexApiClient(IAgent agent, Principal canisterId, CandidConverter? converter = default) + public DexApiClient(IAgent agent, Principal canisterId, IIdentity? identity = default, CandidConverter? converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task cancelOrder(OrderId arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "cancelOrder", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "cancelOrder", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task clear() { CandidArg arg = CandidArg.FromCandid(); - await this.Agent.CallAsync(this.CanisterId, "clear", arg); + await this.Agent.CallAsync(this.CanisterId, "clear", arg, identity: this.Identity); } public async Task credit(Principal arg0, Token arg1, UnboundedUInt arg2) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter), CandidTypedValue.FromObject(arg2, this.Converter)); - await this.Agent.CallAsync(this.CanisterId, "credit", arg); + await this.Agent.CallAsync(this.CanisterId, "credit", arg, identity: this.Identity); } public async Task deposit(Token arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "deposit", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "deposit", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task> getAllBalances() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getAllBalances", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getAllBalances", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task getBalance(Token arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalance", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalance", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task> getBalances() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalances", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalances", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task> getDepositAddress() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getDepositAddress", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getDepositAddress", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task> getOrder(OrderId arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getOrder", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getOrder", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task> getOrders() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getOrders", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getOrders", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task getSymbol(Token arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getSymbol", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getSymbol", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task placeOrder(Token arg0, UnboundedUInt arg1, Token arg2, UnboundedUInt arg3) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter), CandidTypedValue.FromObject(arg2, this.Converter), CandidTypedValue.FromObject(arg3, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "placeOrder", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "placeOrder", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task whoami() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "whoami", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "whoami", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task withdraw(Token arg0, UnboundedUInt arg1, Principal arg2) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter), CandidTypedValue.FromObject(arg2, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "withdraw", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "withdraw", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap index 96b9af9c..aa5fe475 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; @@ -13,108 +14,110 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity? Identity { get; set; } public CandidConverter? Converter { get; } - public DexApiClient(IAgent agent, Principal canisterId, CandidConverter? converter = default) + public DexApiClient(IAgent agent, Principal canisterId, IIdentity? identity = default, CandidConverter? converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task cancelOrder(OrderId arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "cancelOrder", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "cancelOrder", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task clear() { CandidArg arg = CandidArg.FromCandid(); - await this.Agent.CallAsync(this.CanisterId, "clear", arg); + await this.Agent.CallAsync(this.CanisterId, "clear", arg, identity: this.Identity); } public async Task credit(Principal arg0, Token arg1, UnboundedUInt arg2) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter), CandidTypedValue.FromObject(arg2, this.Converter)); - await this.Agent.CallAsync(this.CanisterId, "credit", arg); + await this.Agent.CallAsync(this.CanisterId, "credit", arg, identity: this.Identity); } public async Task deposit(Token arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "deposit", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "deposit", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task> getAllBalances() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getAllBalances", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getAllBalances", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task getBalance(Token arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalance", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalance", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task> getBalances() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalances", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalances", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task> getDepositAddress() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getDepositAddress", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getDepositAddress", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task> getOrder(OrderId arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getOrder", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getOrder", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task> getOrders() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getOrders", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getOrders", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task getSymbol(Token arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getSymbol", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getSymbol", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task placeOrder(Token arg0, UnboundedUInt arg1, Token arg2, UnboundedUInt arg3) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter), CandidTypedValue.FromObject(arg2, this.Converter), CandidTypedValue.FromObject(arg3, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "placeOrder", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "placeOrder", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task whoami() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "whoami", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "whoami", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task withdraw(Token arg0, UnboundedUInt arg1, Principal arg2) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter), CandidTypedValue.FromObject(arg2, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "withdraw", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "withdraw", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap index 55406cba..a890907e 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; @@ -13,108 +14,110 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity? Identity { get; set; } public CandidConverter? Converter { get; } - public DexApiClient(IAgent agent, Principal canisterId, CandidConverter? converter = default) + public DexApiClient(IAgent agent, Principal canisterId, IIdentity? identity = default, CandidConverter? converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task cancelOrder(OrderId arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "cancelOrder", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "cancelOrder", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task clear() { CandidArg arg = CandidArg.FromCandid(); - await this.Agent.CallAsync(this.CanisterId, "clear", arg); + await this.Agent.CallAsync(this.CanisterId, "clear", arg, identity: this.Identity); } public async Task credit(Principal arg0, Token arg1, UnboundedUInt arg2) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter), CandidTypedValue.FromObject(arg2, this.Converter)); - await this.Agent.CallAsync(this.CanisterId, "credit", arg); + await this.Agent.CallAsync(this.CanisterId, "credit", arg, identity: this.Identity); } public async Task deposit(Token arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "deposit", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "deposit", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task> getAllBalances() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getAllBalances", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getAllBalances", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task getBalance(Token arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalance", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalance", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task> getBalances() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalances", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalances", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task> getDepositAddress() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getDepositAddress", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getDepositAddress", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task> getOrder(OrderId arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getOrder", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getOrder", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task> getOrders() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getOrders", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getOrders", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task getSymbol(Token arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getSymbol", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getSymbol", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task placeOrder(Token arg0, UnboundedUInt arg1, Token arg2, UnboundedUInt arg3) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter), CandidTypedValue.FromObject(arg2, this.Converter), CandidTypedValue.FromObject(arg3, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "placeOrder", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "placeOrder", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task whoami() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "whoami", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "whoami", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task withdraw(Token arg0, UnboundedUInt arg1, Principal arg2) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter), CandidTypedValue.FromObject(arg2, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "withdraw", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "withdraw", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap index 4714e572..2cccea2a 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; @@ -13,108 +14,110 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity Identity { get; set; } public CandidConverter Converter { get; } - public DexApiClient(IAgent agent, Principal canisterId, CandidConverter converter = default) + public DexApiClient(IAgent agent, Principal canisterId, IIdentity identity = default, CandidConverter converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task CancelOrder(OrderId arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "cancelOrder", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "cancelOrder", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task Clear() { CandidArg arg = CandidArg.FromCandid(); - await this.Agent.CallAsync(this.CanisterId, "clear", arg); + await this.Agent.CallAsync(this.CanisterId, "clear", arg, identity: this.Identity); } public async Task Credit(Principal arg0, Token arg1, UnboundedUInt arg2) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter), CandidTypedValue.FromObject(arg2, this.Converter)); - await this.Agent.CallAsync(this.CanisterId, "credit", arg); + await this.Agent.CallAsync(this.CanisterId, "credit", arg, identity: this.Identity); } public async Task Deposit(Token arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "deposit", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "deposit", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task> GetAllBalances() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getAllBalances", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getAllBalances", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task GetBalance(Token arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalance", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalance", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task> GetBalances() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalances", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalances", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task> GetDepositAddress() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getDepositAddress", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getDepositAddress", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task> GetOrder(OrderId arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getOrder", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getOrder", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task> GetOrders() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getOrders", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getOrders", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task GetSymbol(Token arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getSymbol", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getSymbol", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task PlaceOrder(Token arg0, UnboundedUInt arg1, Token arg2, UnboundedUInt arg3) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter), CandidTypedValue.FromObject(arg2, this.Converter), CandidTypedValue.FromObject(arg3, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "placeOrder", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "placeOrder", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task Whoami() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "whoami", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "whoami", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task Withdraw(Token arg0, UnboundedUInt arg1, Principal arg2) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter), CandidTypedValue.FromObject(arg2, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "withdraw", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "withdraw", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap index 9ed0133d..341f950e 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; @@ -13,108 +14,110 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity Identity { get; set; } public CandidConverter Converter { get; } - public DexApiClient(IAgent agent, Principal canisterId, CandidConverter converter = default) + public DexApiClient(IAgent agent, Principal canisterId, IIdentity identity = default, CandidConverter converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task CancelOrder(OrderId arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "cancelOrder", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "cancelOrder", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task Clear() { CandidArg arg = CandidArg.FromCandid(); - await this.Agent.CallAsync(this.CanisterId, "clear", arg); + await this.Agent.CallAsync(this.CanisterId, "clear", arg, identity: this.Identity); } public async Task Credit(Principal arg0, Token arg1, UnboundedUInt arg2) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter), CandidTypedValue.FromObject(arg2, this.Converter)); - await this.Agent.CallAsync(this.CanisterId, "credit", arg); + await this.Agent.CallAsync(this.CanisterId, "credit", arg, identity: this.Identity); } public async Task Deposit(Token arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "deposit", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "deposit", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task> GetAllBalances() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getAllBalances", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getAllBalances", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task GetBalance(Token arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalance", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalance", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task> GetBalances() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalances", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalances", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task> GetDepositAddress() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getDepositAddress", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getDepositAddress", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task> GetOrder(OrderId arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getOrder", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getOrder", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task> GetOrders() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getOrders", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getOrders", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task GetSymbol(Token arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getSymbol", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getSymbol", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task PlaceOrder(Token arg0, UnboundedUInt arg1, Token arg2, UnboundedUInt arg3) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter), CandidTypedValue.FromObject(arg2, this.Converter), CandidTypedValue.FromObject(arg3, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "placeOrder", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "placeOrder", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task Whoami() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "whoami", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "whoami", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task Withdraw(Token arg0, UnboundedUInt arg1, Principal arg2) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter), CandidTypedValue.FromObject(arg2, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "withdraw", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "withdraw", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap index beb3b935..fd8daf84 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; @@ -13,108 +14,110 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity Identity { get; set; } public CandidConverter Converter { get; } - public DexApiClient(IAgent agent, Principal canisterId, CandidConverter converter = default) + public DexApiClient(IAgent agent, Principal canisterId, IIdentity identity = default, CandidConverter converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task CancelOrder(OrderId arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "cancelOrder", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "cancelOrder", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task Clear() { CandidArg arg = CandidArg.FromCandid(); - await this.Agent.CallAsync(this.CanisterId, "clear", arg); + await this.Agent.CallAsync(this.CanisterId, "clear", arg, identity: this.Identity); } public async Task Credit(Principal arg0, Token arg1, UnboundedUInt arg2) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter), CandidTypedValue.FromObject(arg2, this.Converter)); - await this.Agent.CallAsync(this.CanisterId, "credit", arg); + await this.Agent.CallAsync(this.CanisterId, "credit", arg, identity: this.Identity); } public async Task Deposit(Token arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "deposit", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "deposit", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task> GetAllBalances() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getAllBalances", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getAllBalances", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task GetBalance(Token arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalance", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalance", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task> GetBalances() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalances", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalances", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task> GetDepositAddress() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getDepositAddress", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getDepositAddress", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task> GetOrder(OrderId arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getOrder", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getOrder", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task> GetOrders() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getOrders", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getOrders", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task GetSymbol(Token arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getSymbol", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getSymbol", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task PlaceOrder(Token arg0, UnboundedUInt arg1, Token arg2, UnboundedUInt arg3) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter), CandidTypedValue.FromObject(arg2, this.Converter), CandidTypedValue.FromObject(arg3, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "placeOrder", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "placeOrder", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task Whoami() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "whoami", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "whoami", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task Withdraw(Token arg0, UnboundedUInt arg1, Principal arg2) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter), CandidTypedValue.FromObject(arg2, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "withdraw", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "withdraw", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap index 6eacae98..5381ec99 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; @@ -13,108 +14,110 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity Identity { get; set; } public CandidConverter Converter { get; } - public DexApiClient(IAgent agent, Principal canisterId, CandidConverter converter = default) + public DexApiClient(IAgent agent, Principal canisterId, IIdentity identity = default, CandidConverter converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task CancelOrder(OrderId arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "cancelOrder", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "cancelOrder", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task Clear() { CandidArg arg = CandidArg.FromCandid(); - await this.Agent.CallAsync(this.CanisterId, "clear", arg); + await this.Agent.CallAsync(this.CanisterId, "clear", arg, identity: this.Identity); } public async Task Credit(Principal arg0, Token arg1, UnboundedUInt arg2) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter), CandidTypedValue.FromObject(arg2, this.Converter)); - await this.Agent.CallAsync(this.CanisterId, "credit", arg); + await this.Agent.CallAsync(this.CanisterId, "credit", arg, identity: this.Identity); } public async Task Deposit(Token arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "deposit", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "deposit", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task> GetAllBalances() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getAllBalances", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getAllBalances", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task GetBalance(Token arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalance", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalance", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task> GetBalances() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalances", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalances", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task> GetDepositAddress() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getDepositAddress", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getDepositAddress", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task> GetOrder(OrderId arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getOrder", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getOrder", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task> GetOrders() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getOrders", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getOrders", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task GetSymbol(Token arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getSymbol", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getSymbol", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task PlaceOrder(Token arg0, UnboundedUInt arg1, Token arg2, UnboundedUInt arg3) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter), CandidTypedValue.FromObject(arg2, this.Converter), CandidTypedValue.FromObject(arg3, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "placeOrder", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "placeOrder", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task Whoami() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "whoami", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "whoami", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task Withdraw(Token arg0, UnboundedUInt arg1, Principal arg2) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter), CandidTypedValue.FromObject(arg2, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "withdraw", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "withdraw", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap index 235d87b4..380ac371 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; @@ -13,108 +14,110 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity Identity { get; set; } public CandidConverter Converter { get; } - public DexApiClient(IAgent agent, Principal canisterId, CandidConverter converter = default) + public DexApiClient(IAgent agent, Principal canisterId, IIdentity identity = default, CandidConverter converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task cancelOrder(OrderId arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "cancelOrder", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "cancelOrder", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task clear() { CandidArg arg = CandidArg.FromCandid(); - await this.Agent.CallAsync(this.CanisterId, "clear", arg); + await this.Agent.CallAsync(this.CanisterId, "clear", arg, identity: this.Identity); } public async Task credit(Principal arg0, Token arg1, UnboundedUInt arg2) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter), CandidTypedValue.FromObject(arg2, this.Converter)); - await this.Agent.CallAsync(this.CanisterId, "credit", arg); + await this.Agent.CallAsync(this.CanisterId, "credit", arg, identity: this.Identity); } public async Task deposit(Token arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "deposit", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "deposit", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task> getAllBalances() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getAllBalances", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getAllBalances", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task getBalance(Token arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalance", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalance", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task> getBalances() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalances", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalances", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task> getDepositAddress() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getDepositAddress", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getDepositAddress", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task> getOrder(OrderId arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getOrder", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getOrder", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task> getOrders() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getOrders", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getOrders", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task getSymbol(Token arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getSymbol", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getSymbol", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task placeOrder(Token arg0, UnboundedUInt arg1, Token arg2, UnboundedUInt arg3) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter), CandidTypedValue.FromObject(arg2, this.Converter), CandidTypedValue.FromObject(arg3, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "placeOrder", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "placeOrder", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task whoami() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "whoami", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "whoami", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task withdraw(Token arg0, UnboundedUInt arg1, Principal arg2) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter), CandidTypedValue.FromObject(arg2, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "withdraw", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "withdraw", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap index e7cb6a86..6c5f9231 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; @@ -13,108 +14,110 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity Identity { get; set; } public CandidConverter Converter { get; } - public DexApiClient(IAgent agent, Principal canisterId, CandidConverter converter = default) + public DexApiClient(IAgent agent, Principal canisterId, IIdentity identity = default, CandidConverter converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task cancelOrder(OrderId arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "cancelOrder", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "cancelOrder", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task clear() { CandidArg arg = CandidArg.FromCandid(); - await this.Agent.CallAsync(this.CanisterId, "clear", arg); + await this.Agent.CallAsync(this.CanisterId, "clear", arg, identity: this.Identity); } public async Task credit(Principal arg0, Token arg1, UnboundedUInt arg2) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter), CandidTypedValue.FromObject(arg2, this.Converter)); - await this.Agent.CallAsync(this.CanisterId, "credit", arg); + await this.Agent.CallAsync(this.CanisterId, "credit", arg, identity: this.Identity); } public async Task deposit(Token arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "deposit", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "deposit", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task> getAllBalances() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getAllBalances", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getAllBalances", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task getBalance(Token arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalance", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalance", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task> getBalances() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalances", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalances", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task> getDepositAddress() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getDepositAddress", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getDepositAddress", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task> getOrder(OrderId arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getOrder", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getOrder", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task> getOrders() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getOrders", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getOrders", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task getSymbol(Token arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getSymbol", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getSymbol", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task placeOrder(Token arg0, UnboundedUInt arg1, Token arg2, UnboundedUInt arg3) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter), CandidTypedValue.FromObject(arg2, this.Converter), CandidTypedValue.FromObject(arg3, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "placeOrder", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "placeOrder", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task whoami() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "whoami", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "whoami", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task withdraw(Token arg0, UnboundedUInt arg1, Principal arg2) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter), CandidTypedValue.FromObject(arg2, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "withdraw", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "withdraw", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap index 9c3da02f..e4fc28ec 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; @@ -13,108 +14,110 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity Identity { get; set; } public CandidConverter Converter { get; } - public DexApiClient(IAgent agent, Principal canisterId, CandidConverter converter = default) + public DexApiClient(IAgent agent, Principal canisterId, IIdentity identity = default, CandidConverter converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task cancelOrder(OrderId arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "cancelOrder", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "cancelOrder", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task clear() { CandidArg arg = CandidArg.FromCandid(); - await this.Agent.CallAsync(this.CanisterId, "clear", arg); + await this.Agent.CallAsync(this.CanisterId, "clear", arg, identity: this.Identity); } public async Task credit(Principal arg0, Token arg1, UnboundedUInt arg2) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter), CandidTypedValue.FromObject(arg2, this.Converter)); - await this.Agent.CallAsync(this.CanisterId, "credit", arg); + await this.Agent.CallAsync(this.CanisterId, "credit", arg, identity: this.Identity); } public async Task deposit(Token arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "deposit", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "deposit", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task> getAllBalances() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getAllBalances", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getAllBalances", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task getBalance(Token arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalance", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalance", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task> getBalances() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalances", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalances", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task> getDepositAddress() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getDepositAddress", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getDepositAddress", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task> getOrder(OrderId arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getOrder", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getOrder", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task> getOrders() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getOrders", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getOrders", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task getSymbol(Token arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getSymbol", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getSymbol", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task placeOrder(Token arg0, UnboundedUInt arg1, Token arg2, UnboundedUInt arg3) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter), CandidTypedValue.FromObject(arg2, this.Converter), CandidTypedValue.FromObject(arg3, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "placeOrder", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "placeOrder", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task whoami() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "whoami", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "whoami", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task withdraw(Token arg0, UnboundedUInt arg1, Principal arg2) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter), CandidTypedValue.FromObject(arg2, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "withdraw", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "withdraw", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap index d5083b29..bfb1bf88 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; @@ -13,108 +14,110 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity Identity { get; set; } public CandidConverter Converter { get; } - public DexApiClient(IAgent agent, Principal canisterId, CandidConverter converter = default) + public DexApiClient(IAgent agent, Principal canisterId, IIdentity identity = default, CandidConverter converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task cancelOrder(OrderId arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "cancelOrder", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "cancelOrder", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task clear() { CandidArg arg = CandidArg.FromCandid(); - await this.Agent.CallAsync(this.CanisterId, "clear", arg); + await this.Agent.CallAsync(this.CanisterId, "clear", arg, identity: this.Identity); } public async Task credit(Principal arg0, Token arg1, UnboundedUInt arg2) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter), CandidTypedValue.FromObject(arg2, this.Converter)); - await this.Agent.CallAsync(this.CanisterId, "credit", arg); + await this.Agent.CallAsync(this.CanisterId, "credit", arg, identity: this.Identity); } public async Task deposit(Token arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "deposit", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "deposit", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task> getAllBalances() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getAllBalances", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getAllBalances", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task getBalance(Token arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalance", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalance", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task> getBalances() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalances", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalances", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task> getDepositAddress() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getDepositAddress", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getDepositAddress", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task> getOrder(OrderId arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getOrder", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getOrder", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task> getOrders() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getOrders", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getOrders", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task getSymbol(Token arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getSymbol", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getSymbol", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task placeOrder(Token arg0, UnboundedUInt arg1, Token arg2, UnboundedUInt arg3) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter), CandidTypedValue.FromObject(arg2, this.Converter), CandidTypedValue.FromObject(arg3, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "placeOrder", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "placeOrder", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task whoami() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "whoami", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "whoami", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task withdraw(Token arg0, UnboundedUInt arg1, Principal arg2) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter), CandidTypedValue.FromObject(arg2, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "withdraw", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "withdraw", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap index b07c5486..5635964d 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; @@ -13,108 +14,110 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity? Identity { get; set; } public CandidConverter? Converter { get; } - public DexApiClient(IAgent agent, Principal canisterId, CandidConverter? converter = default) + public DexApiClient(IAgent agent, Principal canisterId, IIdentity? identity = default, CandidConverter? converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task CancelOrder(OrderId arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "cancelOrder", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "cancelOrder", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task Clear() { CandidArg arg = CandidArg.FromCandid(); - await this.Agent.CallAsync(this.CanisterId, "clear", arg); + await this.Agent.CallAsync(this.CanisterId, "clear", arg, identity: this.Identity); } public async Task Credit(Principal arg0, Token arg1, UnboundedUInt arg2) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter), CandidTypedValue.FromObject(arg2, this.Converter)); - await this.Agent.CallAsync(this.CanisterId, "credit", arg); + await this.Agent.CallAsync(this.CanisterId, "credit", arg, identity: this.Identity); } public async Task Deposit(Token arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "deposit", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "deposit", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task> GetAllBalances() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getAllBalances", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getAllBalances", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task GetBalance(Token arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalance", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalance", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task> GetBalances() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalances", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalances", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task> GetDepositAddress() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getDepositAddress", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getDepositAddress", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task> GetOrder(OrderId arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getOrder", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getOrder", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task> GetOrders() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getOrders", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getOrders", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task GetSymbol(Token arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getSymbol", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getSymbol", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task PlaceOrder(Token arg0, UnboundedUInt arg1, Token arg2, UnboundedUInt arg3) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter), CandidTypedValue.FromObject(arg2, this.Converter), CandidTypedValue.FromObject(arg3, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "placeOrder", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "placeOrder", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task Whoami() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "whoami", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "whoami", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task Withdraw(Token arg0, UnboundedUInt arg1, Principal arg2) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter), CandidTypedValue.FromObject(arg2, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "withdraw", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "withdraw", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap index 496e446b..8e6ad88c 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; @@ -13,108 +14,110 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity? Identity { get; set; } public CandidConverter? Converter { get; } - public DexApiClient(IAgent agent, Principal canisterId, CandidConverter? converter = default) + public DexApiClient(IAgent agent, Principal canisterId, IIdentity? identity = default, CandidConverter? converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task CancelOrder(OrderId arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "cancelOrder", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "cancelOrder", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task Clear() { CandidArg arg = CandidArg.FromCandid(); - await this.Agent.CallAsync(this.CanisterId, "clear", arg); + await this.Agent.CallAsync(this.CanisterId, "clear", arg, identity: this.Identity); } public async Task Credit(Principal arg0, Token arg1, UnboundedUInt arg2) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter), CandidTypedValue.FromObject(arg2, this.Converter)); - await this.Agent.CallAsync(this.CanisterId, "credit", arg); + await this.Agent.CallAsync(this.CanisterId, "credit", arg, identity: this.Identity); } public async Task Deposit(Token arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "deposit", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "deposit", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task> GetAllBalances() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getAllBalances", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getAllBalances", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task GetBalance(Token arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalance", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalance", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task> GetBalances() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalances", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalances", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task> GetDepositAddress() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getDepositAddress", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getDepositAddress", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task> GetOrder(OrderId arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getOrder", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getOrder", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task> GetOrders() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getOrders", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getOrders", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task GetSymbol(Token arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getSymbol", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getSymbol", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task PlaceOrder(Token arg0, UnboundedUInt arg1, Token arg2, UnboundedUInt arg3) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter), CandidTypedValue.FromObject(arg2, this.Converter), CandidTypedValue.FromObject(arg3, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "placeOrder", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "placeOrder", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task Whoami() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "whoami", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "whoami", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task Withdraw(Token arg0, UnboundedUInt arg1, Principal arg2) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter), CandidTypedValue.FromObject(arg2, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "withdraw", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "withdraw", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap index a45ab126..e288814f 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; @@ -13,108 +14,110 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity? Identity { get; set; } public CandidConverter? Converter { get; } - public DexApiClient(IAgent agent, Principal canisterId, CandidConverter? converter = default) + public DexApiClient(IAgent agent, Principal canisterId, IIdentity? identity = default, CandidConverter? converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task CancelOrder(OrderId arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "cancelOrder", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "cancelOrder", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task Clear() { CandidArg arg = CandidArg.FromCandid(); - await this.Agent.CallAsync(this.CanisterId, "clear", arg); + await this.Agent.CallAsync(this.CanisterId, "clear", arg, identity: this.Identity); } public async Task Credit(Principal arg0, Token arg1, UnboundedUInt arg2) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter), CandidTypedValue.FromObject(arg2, this.Converter)); - await this.Agent.CallAsync(this.CanisterId, "credit", arg); + await this.Agent.CallAsync(this.CanisterId, "credit", arg, identity: this.Identity); } public async Task Deposit(Token arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "deposit", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "deposit", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task> GetAllBalances() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getAllBalances", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getAllBalances", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task GetBalance(Token arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalance", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalance", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task> GetBalances() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalances", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalances", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task> GetDepositAddress() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getDepositAddress", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getDepositAddress", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task> GetOrder(OrderId arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getOrder", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getOrder", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task> GetOrders() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getOrders", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getOrders", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task GetSymbol(Token arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getSymbol", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getSymbol", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task PlaceOrder(Token arg0, UnboundedUInt arg1, Token arg2, UnboundedUInt arg3) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter), CandidTypedValue.FromObject(arg2, this.Converter), CandidTypedValue.FromObject(arg3, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "placeOrder", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "placeOrder", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task Whoami() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "whoami", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "whoami", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task Withdraw(Token arg0, UnboundedUInt arg1, Principal arg2) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter), CandidTypedValue.FromObject(arg2, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "withdraw", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "withdraw", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap index df906f58..27bce4cb 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; @@ -13,108 +14,110 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity? Identity { get; set; } public CandidConverter? Converter { get; } - public DexApiClient(IAgent agent, Principal canisterId, CandidConverter? converter = default) + public DexApiClient(IAgent agent, Principal canisterId, IIdentity? identity = default, CandidConverter? converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task CancelOrder(OrderId arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "cancelOrder", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "cancelOrder", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task Clear() { CandidArg arg = CandidArg.FromCandid(); - await this.Agent.CallAsync(this.CanisterId, "clear", arg); + await this.Agent.CallAsync(this.CanisterId, "clear", arg, identity: this.Identity); } public async Task Credit(Principal arg0, Token arg1, UnboundedUInt arg2) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter), CandidTypedValue.FromObject(arg2, this.Converter)); - await this.Agent.CallAsync(this.CanisterId, "credit", arg); + await this.Agent.CallAsync(this.CanisterId, "credit", arg, identity: this.Identity); } public async Task Deposit(Token arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "deposit", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "deposit", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task> GetAllBalances() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getAllBalances", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getAllBalances", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task GetBalance(Token arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalance", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalance", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task> GetBalances() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalances", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalances", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task> GetDepositAddress() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getDepositAddress", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getDepositAddress", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task> GetOrder(OrderId arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getOrder", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getOrder", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task> GetOrders() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getOrders", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getOrders", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task GetSymbol(Token arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getSymbol", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getSymbol", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task PlaceOrder(Token arg0, UnboundedUInt arg1, Token arg2, UnboundedUInt arg3) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter), CandidTypedValue.FromObject(arg2, this.Converter), CandidTypedValue.FromObject(arg3, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "placeOrder", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "placeOrder", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task Whoami() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "whoami", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "whoami", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task Withdraw(Token arg0, UnboundedUInt arg1, Principal arg2) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter), CandidTypedValue.FromObject(arg2, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "withdraw", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "withdraw", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap index 360de9eb..1c8a4056 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; @@ -13,108 +14,110 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity? Identity { get; set; } public CandidConverter? Converter { get; } - public DexApiClient(IAgent agent, Principal canisterId, CandidConverter? converter = default) + public DexApiClient(IAgent agent, Principal canisterId, IIdentity? identity = default, CandidConverter? converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task cancelOrder(OrderId arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "cancelOrder", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "cancelOrder", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task clear() { CandidArg arg = CandidArg.FromCandid(); - await this.Agent.CallAsync(this.CanisterId, "clear", arg); + await this.Agent.CallAsync(this.CanisterId, "clear", arg, identity: this.Identity); } public async Task credit(Principal arg0, Token arg1, UnboundedUInt arg2) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter), CandidTypedValue.FromObject(arg2, this.Converter)); - await this.Agent.CallAsync(this.CanisterId, "credit", arg); + await this.Agent.CallAsync(this.CanisterId, "credit", arg, identity: this.Identity); } public async Task deposit(Token arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "deposit", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "deposit", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task> getAllBalances() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getAllBalances", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getAllBalances", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task getBalance(Token arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalance", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalance", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task> getBalances() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalances", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalances", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task> getDepositAddress() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getDepositAddress", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getDepositAddress", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task> getOrder(OrderId arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getOrder", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getOrder", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task> getOrders() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getOrders", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getOrders", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task getSymbol(Token arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getSymbol", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getSymbol", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task placeOrder(Token arg0, UnboundedUInt arg1, Token arg2, UnboundedUInt arg3) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter), CandidTypedValue.FromObject(arg2, this.Converter), CandidTypedValue.FromObject(arg3, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "placeOrder", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "placeOrder", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task whoami() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "whoami", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "whoami", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task withdraw(Token arg0, UnboundedUInt arg1, Principal arg2) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter), CandidTypedValue.FromObject(arg2, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "withdraw", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "withdraw", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap index c4e5f8d7..727a62f3 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; @@ -13,108 +14,110 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity? Identity { get; set; } public CandidConverter? Converter { get; } - public DexApiClient(IAgent agent, Principal canisterId, CandidConverter? converter = default) + public DexApiClient(IAgent agent, Principal canisterId, IIdentity? identity = default, CandidConverter? converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task cancelOrder(OrderId arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "cancelOrder", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "cancelOrder", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task clear() { CandidArg arg = CandidArg.FromCandid(); - await this.Agent.CallAsync(this.CanisterId, "clear", arg); + await this.Agent.CallAsync(this.CanisterId, "clear", arg, identity: this.Identity); } public async Task credit(Principal arg0, Token arg1, UnboundedUInt arg2) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter), CandidTypedValue.FromObject(arg2, this.Converter)); - await this.Agent.CallAsync(this.CanisterId, "credit", arg); + await this.Agent.CallAsync(this.CanisterId, "credit", arg, identity: this.Identity); } public async Task deposit(Token arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "deposit", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "deposit", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task> getAllBalances() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getAllBalances", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getAllBalances", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task getBalance(Token arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalance", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalance", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task> getBalances() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalances", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalances", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task> getDepositAddress() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getDepositAddress", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getDepositAddress", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task> getOrder(OrderId arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getOrder", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getOrder", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task> getOrders() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getOrders", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getOrders", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task getSymbol(Token arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getSymbol", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getSymbol", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task placeOrder(Token arg0, UnboundedUInt arg1, Token arg2, UnboundedUInt arg3) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter), CandidTypedValue.FromObject(arg2, this.Converter), CandidTypedValue.FromObject(arg3, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "placeOrder", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "placeOrder", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task whoami() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "whoami", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "whoami", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task withdraw(Token arg0, UnboundedUInt arg1, Principal arg2) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter), CandidTypedValue.FromObject(arg2, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "withdraw", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "withdraw", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap index 899f11c8..f8fcceea 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; @@ -13,108 +14,110 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity? Identity { get; set; } public CandidConverter? Converter { get; } - public DexApiClient(IAgent agent, Principal canisterId, CandidConverter? converter = default) + public DexApiClient(IAgent agent, Principal canisterId, IIdentity? identity = default, CandidConverter? converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task cancelOrder(OrderId arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "cancelOrder", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "cancelOrder", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task clear() { CandidArg arg = CandidArg.FromCandid(); - await this.Agent.CallAsync(this.CanisterId, "clear", arg); + await this.Agent.CallAsync(this.CanisterId, "clear", arg, identity: this.Identity); } public async Task credit(Principal arg0, Token arg1, UnboundedUInt arg2) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter), CandidTypedValue.FromObject(arg2, this.Converter)); - await this.Agent.CallAsync(this.CanisterId, "credit", arg); + await this.Agent.CallAsync(this.CanisterId, "credit", arg, identity: this.Identity); } public async Task deposit(Token arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "deposit", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "deposit", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task> getAllBalances() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getAllBalances", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getAllBalances", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task getBalance(Token arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalance", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalance", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task> getBalances() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalances", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalances", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task> getDepositAddress() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getDepositAddress", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getDepositAddress", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task> getOrder(OrderId arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getOrder", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getOrder", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task> getOrders() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getOrders", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getOrders", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task getSymbol(Token arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getSymbol", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getSymbol", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task placeOrder(Token arg0, UnboundedUInt arg1, Token arg2, UnboundedUInt arg3) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter), CandidTypedValue.FromObject(arg2, this.Converter), CandidTypedValue.FromObject(arg3, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "placeOrder", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "placeOrder", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task whoami() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "whoami", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "whoami", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task withdraw(Token arg0, UnboundedUInt arg1, Principal arg2) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter), CandidTypedValue.FromObject(arg2, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "withdraw", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "withdraw", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap index e8b0b9f0..43d313c1 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; @@ -13,108 +14,110 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity? Identity { get; set; } public CandidConverter? Converter { get; } - public DexApiClient(IAgent agent, Principal canisterId, CandidConverter? converter = default) + public DexApiClient(IAgent agent, Principal canisterId, IIdentity? identity = default, CandidConverter? converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task cancelOrder(OrderId arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "cancelOrder", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "cancelOrder", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task clear() { CandidArg arg = CandidArg.FromCandid(); - await this.Agent.CallAsync(this.CanisterId, "clear", arg); + await this.Agent.CallAsync(this.CanisterId, "clear", arg, identity: this.Identity); } public async Task credit(Principal arg0, Token arg1, UnboundedUInt arg2) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter), CandidTypedValue.FromObject(arg2, this.Converter)); - await this.Agent.CallAsync(this.CanisterId, "credit", arg); + await this.Agent.CallAsync(this.CanisterId, "credit", arg, identity: this.Identity); } public async Task deposit(Token arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "deposit", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "deposit", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task> getAllBalances() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getAllBalances", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getAllBalances", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task getBalance(Token arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalance", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalance", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task> getBalances() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalances", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "getBalances", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task> getDepositAddress() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getDepositAddress", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getDepositAddress", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task> getOrder(OrderId arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getOrder", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getOrder", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task> getOrders() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getOrders", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getOrders", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task getSymbol(Token arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getSymbol", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "getSymbol", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task placeOrder(Token arg0, UnboundedUInt arg1, Token arg2, UnboundedUInt arg3) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter), CandidTypedValue.FromObject(arg2, this.Converter), CandidTypedValue.FromObject(arg3, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "placeOrder", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "placeOrder", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task whoami() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "whoami", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "whoami", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task withdraw(Token arg0, UnboundedUInt arg1, Principal arg2) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter), CandidTypedValue.FromObject(arg2, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "withdraw", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "withdraw", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap index f9a2bba8..6e940d13 100644 --- a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; @@ -10,19 +11,21 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity Identity { get; set; } public CandidConverter Converter { get; } - public DuplicatePropertyNamesApiClient(IAgent agent, Principal canisterId, CandidConverter converter = default) + public DuplicatePropertyNamesApiClient(IAgent agent, Principal canisterId, IIdentity identity = default, CandidConverter converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task A() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap index f9a2bba8..6e940d13 100644 --- a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; @@ -10,19 +11,21 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity Identity { get; set; } public CandidConverter Converter { get; } - public DuplicatePropertyNamesApiClient(IAgent agent, Principal canisterId, CandidConverter converter = default) + public DuplicatePropertyNamesApiClient(IAgent agent, Principal canisterId, IIdentity identity = default, CandidConverter converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task A() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap index f9a2bba8..6e940d13 100644 --- a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; @@ -10,19 +11,21 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity Identity { get; set; } public CandidConverter Converter { get; } - public DuplicatePropertyNamesApiClient(IAgent agent, Principal canisterId, CandidConverter converter = default) + public DuplicatePropertyNamesApiClient(IAgent agent, Principal canisterId, IIdentity identity = default, CandidConverter converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task A() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap index f9a2bba8..6e940d13 100644 --- a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; @@ -10,19 +11,21 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity Identity { get; set; } public CandidConverter Converter { get; } - public DuplicatePropertyNamesApiClient(IAgent agent, Principal canisterId, CandidConverter converter = default) + public DuplicatePropertyNamesApiClient(IAgent agent, Principal canisterId, IIdentity identity = default, CandidConverter converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task A() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap index 32577ae8..cbe36050 100644 --- a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; @@ -10,19 +11,21 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity Identity { get; set; } public CandidConverter Converter { get; } - public DuplicatePropertyNamesApiClient(IAgent agent, Principal canisterId, CandidConverter converter = default) + public DuplicatePropertyNamesApiClient(IAgent agent, Principal canisterId, IIdentity identity = default, CandidConverter converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task a() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap index 32577ae8..cbe36050 100644 --- a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; @@ -10,19 +11,21 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity Identity { get; set; } public CandidConverter Converter { get; } - public DuplicatePropertyNamesApiClient(IAgent agent, Principal canisterId, CandidConverter converter = default) + public DuplicatePropertyNamesApiClient(IAgent agent, Principal canisterId, IIdentity identity = default, CandidConverter converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task a() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap index 32577ae8..cbe36050 100644 --- a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; @@ -10,19 +11,21 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity Identity { get; set; } public CandidConverter Converter { get; } - public DuplicatePropertyNamesApiClient(IAgent agent, Principal canisterId, CandidConverter converter = default) + public DuplicatePropertyNamesApiClient(IAgent agent, Principal canisterId, IIdentity identity = default, CandidConverter converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task a() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap index 32577ae8..cbe36050 100644 --- a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; @@ -10,19 +11,21 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity Identity { get; set; } public CandidConverter Converter { get; } - public DuplicatePropertyNamesApiClient(IAgent agent, Principal canisterId, CandidConverter converter = default) + public DuplicatePropertyNamesApiClient(IAgent agent, Principal canisterId, IIdentity identity = default, CandidConverter converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task a() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap index 2f24e42b..18de492f 100644 --- a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; @@ -10,19 +11,21 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity? Identity { get; set; } public CandidConverter? Converter { get; } - public DuplicatePropertyNamesApiClient(IAgent agent, Principal canisterId, CandidConverter? converter = default) + public DuplicatePropertyNamesApiClient(IAgent agent, Principal canisterId, IIdentity? identity = default, CandidConverter? converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task A() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap index 2f24e42b..18de492f 100644 --- a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; @@ -10,19 +11,21 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity? Identity { get; set; } public CandidConverter? Converter { get; } - public DuplicatePropertyNamesApiClient(IAgent agent, Principal canisterId, CandidConverter? converter = default) + public DuplicatePropertyNamesApiClient(IAgent agent, Principal canisterId, IIdentity? identity = default, CandidConverter? converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task A() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap index 2f24e42b..18de492f 100644 --- a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; @@ -10,19 +11,21 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity? Identity { get; set; } public CandidConverter? Converter { get; } - public DuplicatePropertyNamesApiClient(IAgent agent, Principal canisterId, CandidConverter? converter = default) + public DuplicatePropertyNamesApiClient(IAgent agent, Principal canisterId, IIdentity? identity = default, CandidConverter? converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task A() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap index 2f24e42b..18de492f 100644 --- a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; @@ -10,19 +11,21 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity? Identity { get; set; } public CandidConverter? Converter { get; } - public DuplicatePropertyNamesApiClient(IAgent agent, Principal canisterId, CandidConverter? converter = default) + public DuplicatePropertyNamesApiClient(IAgent agent, Principal canisterId, IIdentity? identity = default, CandidConverter? converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task A() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap index 61f40f52..16426a1d 100644 --- a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; @@ -10,19 +11,21 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity? Identity { get; set; } public CandidConverter? Converter { get; } - public DuplicatePropertyNamesApiClient(IAgent agent, Principal canisterId, CandidConverter? converter = default) + public DuplicatePropertyNamesApiClient(IAgent agent, Principal canisterId, IIdentity? identity = default, CandidConverter? converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task a() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap index 61f40f52..16426a1d 100644 --- a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; @@ -10,19 +11,21 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity? Identity { get; set; } public CandidConverter? Converter { get; } - public DuplicatePropertyNamesApiClient(IAgent agent, Principal canisterId, CandidConverter? converter = default) + public DuplicatePropertyNamesApiClient(IAgent agent, Principal canisterId, IIdentity? identity = default, CandidConverter? converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task a() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap index 61f40f52..16426a1d 100644 --- a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; @@ -10,19 +11,21 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity? Identity { get; set; } public CandidConverter? Converter { get; } - public DuplicatePropertyNamesApiClient(IAgent agent, Principal canisterId, CandidConverter? converter = default) + public DuplicatePropertyNamesApiClient(IAgent agent, Principal canisterId, IIdentity? identity = default, CandidConverter? converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task a() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap index 61f40f52..16426a1d 100644 --- a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; @@ -10,19 +11,21 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity? Identity { get; set; } public CandidConverter? Converter { get; } - public DuplicatePropertyNamesApiClient(IAgent agent, Principal canisterId, CandidConverter? converter = default) + public DuplicatePropertyNamesApiClient(IAgent agent, Principal canisterId, IIdentity? identity = default, CandidConverter? converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task a() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap index a8c31e5a..f92f13f9 100644 --- a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; @@ -10,19 +11,21 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity Identity { get; set; } public CandidConverter Converter { get; } - public DuplicatePropertyNamesApiClient(IAgent agent, Principal canisterId, CandidConverter converter = default) + public DuplicatePropertyNamesApiClient(IAgent agent, Principal canisterId, IIdentity identity = default, CandidConverter converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task A() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap index a8c31e5a..f92f13f9 100644 --- a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; @@ -10,19 +11,21 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity Identity { get; set; } public CandidConverter Converter { get; } - public DuplicatePropertyNamesApiClient(IAgent agent, Principal canisterId, CandidConverter converter = default) + public DuplicatePropertyNamesApiClient(IAgent agent, Principal canisterId, IIdentity identity = default, CandidConverter converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task A() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap index a8c31e5a..f92f13f9 100644 --- a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; @@ -10,19 +11,21 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity Identity { get; set; } public CandidConverter Converter { get; } - public DuplicatePropertyNamesApiClient(IAgent agent, Principal canisterId, CandidConverter converter = default) + public DuplicatePropertyNamesApiClient(IAgent agent, Principal canisterId, IIdentity identity = default, CandidConverter converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task A() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap index a8c31e5a..f92f13f9 100644 --- a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; @@ -10,19 +11,21 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity Identity { get; set; } public CandidConverter Converter { get; } - public DuplicatePropertyNamesApiClient(IAgent agent, Principal canisterId, CandidConverter converter = default) + public DuplicatePropertyNamesApiClient(IAgent agent, Principal canisterId, IIdentity identity = default, CandidConverter converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task A() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap index 65421a19..89c9aa03 100644 --- a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; @@ -10,19 +11,21 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity Identity { get; set; } public CandidConverter Converter { get; } - public DuplicatePropertyNamesApiClient(IAgent agent, Principal canisterId, CandidConverter converter = default) + public DuplicatePropertyNamesApiClient(IAgent agent, Principal canisterId, IIdentity identity = default, CandidConverter converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task a() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap index 65421a19..89c9aa03 100644 --- a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; @@ -10,19 +11,21 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity Identity { get; set; } public CandidConverter Converter { get; } - public DuplicatePropertyNamesApiClient(IAgent agent, Principal canisterId, CandidConverter converter = default) + public DuplicatePropertyNamesApiClient(IAgent agent, Principal canisterId, IIdentity identity = default, CandidConverter converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task a() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap index 65421a19..89c9aa03 100644 --- a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; @@ -10,19 +11,21 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity Identity { get; set; } public CandidConverter Converter { get; } - public DuplicatePropertyNamesApiClient(IAgent agent, Principal canisterId, CandidConverter converter = default) + public DuplicatePropertyNamesApiClient(IAgent agent, Principal canisterId, IIdentity identity = default, CandidConverter converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task a() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap index 65421a19..89c9aa03 100644 --- a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; @@ -10,19 +11,21 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity Identity { get; set; } public CandidConverter Converter { get; } - public DuplicatePropertyNamesApiClient(IAgent agent, Principal canisterId, CandidConverter converter = default) + public DuplicatePropertyNamesApiClient(IAgent agent, Principal canisterId, IIdentity identity = default, CandidConverter converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task a() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap index 986ff6f9..14ee3efb 100644 --- a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; @@ -10,19 +11,21 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity? Identity { get; set; } public CandidConverter? Converter { get; } - public DuplicatePropertyNamesApiClient(IAgent agent, Principal canisterId, CandidConverter? converter = default) + public DuplicatePropertyNamesApiClient(IAgent agent, Principal canisterId, IIdentity? identity = default, CandidConverter? converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task A() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap index 986ff6f9..14ee3efb 100644 --- a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; @@ -10,19 +11,21 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity? Identity { get; set; } public CandidConverter? Converter { get; } - public DuplicatePropertyNamesApiClient(IAgent agent, Principal canisterId, CandidConverter? converter = default) + public DuplicatePropertyNamesApiClient(IAgent agent, Principal canisterId, IIdentity? identity = default, CandidConverter? converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task A() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap index 986ff6f9..14ee3efb 100644 --- a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; @@ -10,19 +11,21 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity? Identity { get; set; } public CandidConverter? Converter { get; } - public DuplicatePropertyNamesApiClient(IAgent agent, Principal canisterId, CandidConverter? converter = default) + public DuplicatePropertyNamesApiClient(IAgent agent, Principal canisterId, IIdentity? identity = default, CandidConverter? converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task A() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap index 986ff6f9..14ee3efb 100644 --- a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; @@ -10,19 +11,21 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity? Identity { get; set; } public CandidConverter? Converter { get; } - public DuplicatePropertyNamesApiClient(IAgent agent, Principal canisterId, CandidConverter? converter = default) + public DuplicatePropertyNamesApiClient(IAgent agent, Principal canisterId, IIdentity? identity = default, CandidConverter? converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task A() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap index f1903881..04567d86 100644 --- a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; @@ -10,19 +11,21 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity? Identity { get; set; } public CandidConverter? Converter { get; } - public DuplicatePropertyNamesApiClient(IAgent agent, Principal canisterId, CandidConverter? converter = default) + public DuplicatePropertyNamesApiClient(IAgent agent, Principal canisterId, IIdentity? identity = default, CandidConverter? converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task a() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap index f1903881..04567d86 100644 --- a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; @@ -10,19 +11,21 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity? Identity { get; set; } public CandidConverter? Converter { get; } - public DuplicatePropertyNamesApiClient(IAgent agent, Principal canisterId, CandidConverter? converter = default) + public DuplicatePropertyNamesApiClient(IAgent agent, Principal canisterId, IIdentity? identity = default, CandidConverter? converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task a() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap index f1903881..04567d86 100644 --- a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; @@ -10,19 +11,21 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity? Identity { get; set; } public CandidConverter? Converter { get; } - public DuplicatePropertyNamesApiClient(IAgent agent, Principal canisterId, CandidConverter? converter = default) + public DuplicatePropertyNamesApiClient(IAgent agent, Principal canisterId, IIdentity? identity = default, CandidConverter? converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task a() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap index f1903881..04567d86 100644 --- a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; @@ -10,19 +11,21 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity? Identity { get; set; } public CandidConverter? Converter { get; } - public DuplicatePropertyNamesApiClient(IAgent agent, Principal canisterId, CandidConverter? converter = default) + public DuplicatePropertyNamesApiClient(IAgent agent, Principal canisterId, IIdentity? identity = default, CandidConverter? converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task a() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap index 4b31108e..58e26c7a 100644 --- a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; @@ -10,19 +11,21 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity Identity { get; set; } public CandidConverter Converter { get; } - public FuncTypeApiClient(IAgent agent, Principal canisterId, CandidConverter converter = default) + public FuncTypeApiClient(IAgent agent, Principal canisterId, IIdentity identity = default, CandidConverter converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task A() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap index 4b31108e..58e26c7a 100644 --- a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; @@ -10,19 +11,21 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity Identity { get; set; } public CandidConverter Converter { get; } - public FuncTypeApiClient(IAgent agent, Principal canisterId, CandidConverter converter = default) + public FuncTypeApiClient(IAgent agent, Principal canisterId, IIdentity identity = default, CandidConverter converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task A() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap index 4b31108e..58e26c7a 100644 --- a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; @@ -10,19 +11,21 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity Identity { get; set; } public CandidConverter Converter { get; } - public FuncTypeApiClient(IAgent agent, Principal canisterId, CandidConverter converter = default) + public FuncTypeApiClient(IAgent agent, Principal canisterId, IIdentity identity = default, CandidConverter converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task A() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap index 4b31108e..58e26c7a 100644 --- a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; @@ -10,19 +11,21 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity Identity { get; set; } public CandidConverter Converter { get; } - public FuncTypeApiClient(IAgent agent, Principal canisterId, CandidConverter converter = default) + public FuncTypeApiClient(IAgent agent, Principal canisterId, IIdentity identity = default, CandidConverter converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task A() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap index 1abdbfbe..540de82c 100644 --- a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; @@ -10,19 +11,21 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity Identity { get; set; } public CandidConverter Converter { get; } - public FuncTypeApiClient(IAgent agent, Principal canisterId, CandidConverter converter = default) + public FuncTypeApiClient(IAgent agent, Principal canisterId, IIdentity identity = default, CandidConverter converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task a() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap index 1abdbfbe..540de82c 100644 --- a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; @@ -10,19 +11,21 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity Identity { get; set; } public CandidConverter Converter { get; } - public FuncTypeApiClient(IAgent agent, Principal canisterId, CandidConverter converter = default) + public FuncTypeApiClient(IAgent agent, Principal canisterId, IIdentity identity = default, CandidConverter converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task a() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap index 1abdbfbe..540de82c 100644 --- a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; @@ -10,19 +11,21 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity Identity { get; set; } public CandidConverter Converter { get; } - public FuncTypeApiClient(IAgent agent, Principal canisterId, CandidConverter converter = default) + public FuncTypeApiClient(IAgent agent, Principal canisterId, IIdentity identity = default, CandidConverter converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task a() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap index 1abdbfbe..540de82c 100644 --- a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; @@ -10,19 +11,21 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity Identity { get; set; } public CandidConverter Converter { get; } - public FuncTypeApiClient(IAgent agent, Principal canisterId, CandidConverter converter = default) + public FuncTypeApiClient(IAgent agent, Principal canisterId, IIdentity identity = default, CandidConverter converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task a() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap index d2c97be3..ff695ccd 100644 --- a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; @@ -10,19 +11,21 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity? Identity { get; set; } public CandidConverter? Converter { get; } - public FuncTypeApiClient(IAgent agent, Principal canisterId, CandidConverter? converter = default) + public FuncTypeApiClient(IAgent agent, Principal canisterId, IIdentity? identity = default, CandidConverter? converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task A() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap index d2c97be3..ff695ccd 100644 --- a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; @@ -10,19 +11,21 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity? Identity { get; set; } public CandidConverter? Converter { get; } - public FuncTypeApiClient(IAgent agent, Principal canisterId, CandidConverter? converter = default) + public FuncTypeApiClient(IAgent agent, Principal canisterId, IIdentity? identity = default, CandidConverter? converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task A() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap index d2c97be3..ff695ccd 100644 --- a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; @@ -10,19 +11,21 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity? Identity { get; set; } public CandidConverter? Converter { get; } - public FuncTypeApiClient(IAgent agent, Principal canisterId, CandidConverter? converter = default) + public FuncTypeApiClient(IAgent agent, Principal canisterId, IIdentity? identity = default, CandidConverter? converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task A() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap index d2c97be3..ff695ccd 100644 --- a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; @@ -10,19 +11,21 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity? Identity { get; set; } public CandidConverter? Converter { get; } - public FuncTypeApiClient(IAgent agent, Principal canisterId, CandidConverter? converter = default) + public FuncTypeApiClient(IAgent agent, Principal canisterId, IIdentity? identity = default, CandidConverter? converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task A() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap index d1221f90..7f8ee79b 100644 --- a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; @@ -10,19 +11,21 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity? Identity { get; set; } public CandidConverter? Converter { get; } - public FuncTypeApiClient(IAgent agent, Principal canisterId, CandidConverter? converter = default) + public FuncTypeApiClient(IAgent agent, Principal canisterId, IIdentity? identity = default, CandidConverter? converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task a() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap index d1221f90..7f8ee79b 100644 --- a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; @@ -10,19 +11,21 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity? Identity { get; set; } public CandidConverter? Converter { get; } - public FuncTypeApiClient(IAgent agent, Principal canisterId, CandidConverter? converter = default) + public FuncTypeApiClient(IAgent agent, Principal canisterId, IIdentity? identity = default, CandidConverter? converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task a() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap index d1221f90..7f8ee79b 100644 --- a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; @@ -10,19 +11,21 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity? Identity { get; set; } public CandidConverter? Converter { get; } - public FuncTypeApiClient(IAgent agent, Principal canisterId, CandidConverter? converter = default) + public FuncTypeApiClient(IAgent agent, Principal canisterId, IIdentity? identity = default, CandidConverter? converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task a() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap index d1221f90..7f8ee79b 100644 --- a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; @@ -10,19 +11,21 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity? Identity { get; set; } public CandidConverter? Converter { get; } - public FuncTypeApiClient(IAgent agent, Principal canisterId, CandidConverter? converter = default) + public FuncTypeApiClient(IAgent agent, Principal canisterId, IIdentity? identity = default, CandidConverter? converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task a() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap index 61190d86..0c68168e 100644 --- a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; @@ -10,19 +11,21 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity Identity { get; set; } public CandidConverter Converter { get; } - public FuncTypeApiClient(IAgent agent, Principal canisterId, CandidConverter converter = default) + public FuncTypeApiClient(IAgent agent, Principal canisterId, IIdentity identity = default, CandidConverter converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task A() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap index 61190d86..0c68168e 100644 --- a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; @@ -10,19 +11,21 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity Identity { get; set; } public CandidConverter Converter { get; } - public FuncTypeApiClient(IAgent agent, Principal canisterId, CandidConverter converter = default) + public FuncTypeApiClient(IAgent agent, Principal canisterId, IIdentity identity = default, CandidConverter converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task A() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap index 61190d86..0c68168e 100644 --- a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; @@ -10,19 +11,21 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity Identity { get; set; } public CandidConverter Converter { get; } - public FuncTypeApiClient(IAgent agent, Principal canisterId, CandidConverter converter = default) + public FuncTypeApiClient(IAgent agent, Principal canisterId, IIdentity identity = default, CandidConverter converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task A() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap index 61190d86..0c68168e 100644 --- a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; @@ -10,19 +11,21 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity Identity { get; set; } public CandidConverter Converter { get; } - public FuncTypeApiClient(IAgent agent, Principal canisterId, CandidConverter converter = default) + public FuncTypeApiClient(IAgent agent, Principal canisterId, IIdentity identity = default, CandidConverter converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task A() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap index 0ccacefd..d517ae32 100644 --- a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; @@ -10,19 +11,21 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity Identity { get; set; } public CandidConverter Converter { get; } - public FuncTypeApiClient(IAgent agent, Principal canisterId, CandidConverter converter = default) + public FuncTypeApiClient(IAgent agent, Principal canisterId, IIdentity identity = default, CandidConverter converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task a() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap index 0ccacefd..d517ae32 100644 --- a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; @@ -10,19 +11,21 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity Identity { get; set; } public CandidConverter Converter { get; } - public FuncTypeApiClient(IAgent agent, Principal canisterId, CandidConverter converter = default) + public FuncTypeApiClient(IAgent agent, Principal canisterId, IIdentity identity = default, CandidConverter converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task a() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap index 0ccacefd..d517ae32 100644 --- a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; @@ -10,19 +11,21 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity Identity { get; set; } public CandidConverter Converter { get; } - public FuncTypeApiClient(IAgent agent, Principal canisterId, CandidConverter converter = default) + public FuncTypeApiClient(IAgent agent, Principal canisterId, IIdentity identity = default, CandidConverter converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task a() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap index 0ccacefd..d517ae32 100644 --- a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; @@ -10,19 +11,21 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity Identity { get; set; } public CandidConverter Converter { get; } - public FuncTypeApiClient(IAgent agent, Principal canisterId, CandidConverter converter = default) + public FuncTypeApiClient(IAgent agent, Principal canisterId, IIdentity identity = default, CandidConverter converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task a() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap index 0d2d7c53..fed0ef3c 100644 --- a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; @@ -10,19 +11,21 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity? Identity { get; set; } public CandidConverter? Converter { get; } - public FuncTypeApiClient(IAgent agent, Principal canisterId, CandidConverter? converter = default) + public FuncTypeApiClient(IAgent agent, Principal canisterId, IIdentity? identity = default, CandidConverter? converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task A() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap index 0d2d7c53..fed0ef3c 100644 --- a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; @@ -10,19 +11,21 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity? Identity { get; set; } public CandidConverter? Converter { get; } - public FuncTypeApiClient(IAgent agent, Principal canisterId, CandidConverter? converter = default) + public FuncTypeApiClient(IAgent agent, Principal canisterId, IIdentity? identity = default, CandidConverter? converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task A() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap index 0d2d7c53..fed0ef3c 100644 --- a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; @@ -10,19 +11,21 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity? Identity { get; set; } public CandidConverter? Converter { get; } - public FuncTypeApiClient(IAgent agent, Principal canisterId, CandidConverter? converter = default) + public FuncTypeApiClient(IAgent agent, Principal canisterId, IIdentity? identity = default, CandidConverter? converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task A() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap index 0d2d7c53..fed0ef3c 100644 --- a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; @@ -10,19 +11,21 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity? Identity { get; set; } public CandidConverter? Converter { get; } - public FuncTypeApiClient(IAgent agent, Principal canisterId, CandidConverter? converter = default) + public FuncTypeApiClient(IAgent agent, Principal canisterId, IIdentity? identity = default, CandidConverter? converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task A() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap index 4b00b2c0..9cda1506 100644 --- a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; @@ -10,19 +11,21 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity? Identity { get; set; } public CandidConverter? Converter { get; } - public FuncTypeApiClient(IAgent agent, Principal canisterId, CandidConverter? converter = default) + public FuncTypeApiClient(IAgent agent, Principal canisterId, IIdentity? identity = default, CandidConverter? converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task a() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap index 4b00b2c0..9cda1506 100644 --- a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; @@ -10,19 +11,21 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity? Identity { get; set; } public CandidConverter? Converter { get; } - public FuncTypeApiClient(IAgent agent, Principal canisterId, CandidConverter? converter = default) + public FuncTypeApiClient(IAgent agent, Principal canisterId, IIdentity? identity = default, CandidConverter? converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task a() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap index 4b00b2c0..9cda1506 100644 --- a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; @@ -10,19 +11,21 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity? Identity { get; set; } public CandidConverter? Converter { get; } - public FuncTypeApiClient(IAgent agent, Principal canisterId, CandidConverter? converter = default) + public FuncTypeApiClient(IAgent agent, Principal canisterId, IIdentity? identity = default, CandidConverter? converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task a() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap index 4b00b2c0..9cda1506 100644 --- a/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/FuncType_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; @@ -10,19 +11,21 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity? Identity { get; set; } public CandidConverter? Converter { get; } - public FuncTypeApiClient(IAgent agent, Principal canisterId, CandidConverter? converter = default) + public FuncTypeApiClient(IAgent agent, Principal canisterId, IIdentity? identity = default, CandidConverter? converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task a() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "a", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap index 786e3a95..ecc11a93 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; @@ -11,152 +12,154 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity Identity { get; set; } public CandidConverter Converter { get; } - public GovernanceApiClient(IAgent agent, Principal canisterId, CandidConverter converter = default) + public GovernanceApiClient(IAgent agent, Principal canisterId, IIdentity identity = default, CandidConverter converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task ClaimGtcNeurons(Principal arg0, List arg1) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "claim_gtc_neurons", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "claim_gtc_neurons", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task ClaimOrRefreshNeuronFromAccount(Models.ClaimOrRefreshNeuronFromAccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "claim_or_refresh_neuron_from_account", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "claim_or_refresh_neuron_from_account", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task GetBuildMetadata() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_build_metadata", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_build_metadata", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task GetFullNeuron(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task GetFullNeuronByIdOrSubaccount(Models.NeuronIdOrSubaccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron_by_id_or_subaccount", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron_by_id_or_subaccount", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task GetMonthlyNodeProviderRewards() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "get_monthly_node_provider_rewards", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "get_monthly_node_provider_rewards", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task GetNetworkEconomicsParameters() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_network_economics_parameters", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_network_economics_parameters", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task> GetNeuronIds() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_ids", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_ids", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task GetNeuronInfo(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task GetNeuronInfoByIdOrSubaccount(Models.NeuronIdOrSubaccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info_by_id_or_subaccount", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info_by_id_or_subaccount", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task GetNodeProviderByCaller(NullValue arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_node_provider_by_caller", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_node_provider_by_caller", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task> GetPendingProposals() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_pending_proposals", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_pending_proposals", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task> GetProposalInfo(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_proposal_info", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_proposal_info", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task ListKnownNeurons() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_known_neurons", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_known_neurons", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task ListNeurons(Models.ListNeurons arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_neurons", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_neurons", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task ListNodeProviders() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_node_providers", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_node_providers", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task ListProposals(Models.ListProposalInfo arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_proposals", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_proposals", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task ManageNeuron(Models.ManageNeuron arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "manage_neuron", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "manage_neuron", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task TransferGtcNeuron(Models.NeuronId arg0, Models.NeuronId arg1) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "transfer_gtc_neuron", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "transfer_gtc_neuron", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task UpdateNodeProvider(Models.UpdateNodeProvider arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "update_node_provider", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "update_node_provider", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap index ebac31fb..476dfe54 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; @@ -11,152 +12,154 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity Identity { get; set; } public CandidConverter Converter { get; } - public GovernanceApiClient(IAgent agent, Principal canisterId, CandidConverter converter = default) + public GovernanceApiClient(IAgent agent, Principal canisterId, IIdentity identity = default, CandidConverter converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task ClaimGtcNeurons(Principal arg0, List arg1) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "claim_gtc_neurons", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "claim_gtc_neurons", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task ClaimOrRefreshNeuronFromAccount(Models.ClaimOrRefreshNeuronFromAccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "claim_or_refresh_neuron_from_account", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "claim_or_refresh_neuron_from_account", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task GetBuildMetadata() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_build_metadata", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_build_metadata", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task GetFullNeuron(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task GetFullNeuronByIdOrSubaccount(Models.NeuronIdOrSubaccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron_by_id_or_subaccount", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron_by_id_or_subaccount", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task GetMonthlyNodeProviderRewards() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "get_monthly_node_provider_rewards", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "get_monthly_node_provider_rewards", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task GetNetworkEconomicsParameters() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_network_economics_parameters", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_network_economics_parameters", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task> GetNeuronIds() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_ids", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_ids", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task GetNeuronInfo(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task GetNeuronInfoByIdOrSubaccount(Models.NeuronIdOrSubaccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info_by_id_or_subaccount", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info_by_id_or_subaccount", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task GetNodeProviderByCaller(NullValue arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_node_provider_by_caller", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_node_provider_by_caller", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task> GetPendingProposals() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_pending_proposals", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_pending_proposals", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task> GetProposalInfo(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_proposal_info", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_proposal_info", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task ListKnownNeurons() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_known_neurons", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_known_neurons", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task ListNeurons(Models.ListNeurons arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_neurons", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_neurons", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task ListNodeProviders() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_node_providers", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_node_providers", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task ListProposals(Models.ListProposalInfo arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_proposals", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_proposals", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task ManageNeuron(Models.ManageNeuron arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "manage_neuron", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "manage_neuron", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task TransferGtcNeuron(Models.NeuronId arg0, Models.NeuronId arg1) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "transfer_gtc_neuron", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "transfer_gtc_neuron", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task UpdateNodeProvider(Models.UpdateNodeProvider arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "update_node_provider", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "update_node_provider", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap index 3ae2bc79..adda96a0 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; @@ -11,152 +12,154 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity Identity { get; set; } public CandidConverter Converter { get; } - public GovernanceApiClient(IAgent agent, Principal canisterId, CandidConverter converter = default) + public GovernanceApiClient(IAgent agent, Principal canisterId, IIdentity identity = default, CandidConverter converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task ClaimGtcNeurons(Principal arg0, List arg1) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "claim_gtc_neurons", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "claim_gtc_neurons", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task ClaimOrRefreshNeuronFromAccount(Models.ClaimOrRefreshNeuronFromAccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "claim_or_refresh_neuron_from_account", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "claim_or_refresh_neuron_from_account", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task GetBuildMetadata() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_build_metadata", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_build_metadata", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task GetFullNeuron(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task GetFullNeuronByIdOrSubaccount(Models.NeuronIdOrSubaccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron_by_id_or_subaccount", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron_by_id_or_subaccount", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task GetMonthlyNodeProviderRewards() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "get_monthly_node_provider_rewards", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "get_monthly_node_provider_rewards", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task GetNetworkEconomicsParameters() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_network_economics_parameters", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_network_economics_parameters", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task> GetNeuronIds() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_ids", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_ids", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task GetNeuronInfo(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task GetNeuronInfoByIdOrSubaccount(Models.NeuronIdOrSubaccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info_by_id_or_subaccount", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info_by_id_or_subaccount", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task GetNodeProviderByCaller(NullValue arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_node_provider_by_caller", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_node_provider_by_caller", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task> GetPendingProposals() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_pending_proposals", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_pending_proposals", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task> GetProposalInfo(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_proposal_info", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_proposal_info", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task ListKnownNeurons() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_known_neurons", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_known_neurons", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task ListNeurons(Models.ListNeurons arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_neurons", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_neurons", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task ListNodeProviders() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_node_providers", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_node_providers", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task ListProposals(Models.ListProposalInfo arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_proposals", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_proposals", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task ManageNeuron(Models.ManageNeuron arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "manage_neuron", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "manage_neuron", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task TransferGtcNeuron(Models.NeuronId arg0, Models.NeuronId arg1) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "transfer_gtc_neuron", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "transfer_gtc_neuron", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task UpdateNodeProvider(Models.UpdateNodeProvider arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "update_node_provider", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "update_node_provider", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap index 85ad420f..1a55b74f 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; @@ -11,152 +12,154 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity Identity { get; set; } public CandidConverter Converter { get; } - public GovernanceApiClient(IAgent agent, Principal canisterId, CandidConverter converter = default) + public GovernanceApiClient(IAgent agent, Principal canisterId, IIdentity identity = default, CandidConverter converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task ClaimGtcNeurons(Principal arg0, List arg1) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "claim_gtc_neurons", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "claim_gtc_neurons", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task ClaimOrRefreshNeuronFromAccount(Models.ClaimOrRefreshNeuronFromAccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "claim_or_refresh_neuron_from_account", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "claim_or_refresh_neuron_from_account", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task GetBuildMetadata() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_build_metadata", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_build_metadata", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task GetFullNeuron(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task GetFullNeuronByIdOrSubaccount(Models.NeuronIdOrSubaccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron_by_id_or_subaccount", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron_by_id_or_subaccount", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task GetMonthlyNodeProviderRewards() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "get_monthly_node_provider_rewards", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "get_monthly_node_provider_rewards", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task GetNetworkEconomicsParameters() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_network_economics_parameters", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_network_economics_parameters", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task> GetNeuronIds() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_ids", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_ids", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task GetNeuronInfo(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task GetNeuronInfoByIdOrSubaccount(Models.NeuronIdOrSubaccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info_by_id_or_subaccount", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info_by_id_or_subaccount", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task GetNodeProviderByCaller(NullValue arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_node_provider_by_caller", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_node_provider_by_caller", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task> GetPendingProposals() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_pending_proposals", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_pending_proposals", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task> GetProposalInfo(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_proposal_info", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_proposal_info", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task ListKnownNeurons() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_known_neurons", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_known_neurons", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task ListNeurons(Models.ListNeurons arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_neurons", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_neurons", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task ListNodeProviders() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_node_providers", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_node_providers", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task ListProposals(Models.ListProposalInfo arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_proposals", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_proposals", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task ManageNeuron(Models.ManageNeuron arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "manage_neuron", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "manage_neuron", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task TransferGtcNeuron(Models.NeuronId arg0, Models.NeuronId arg1) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "transfer_gtc_neuron", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "transfer_gtc_neuron", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task UpdateNodeProvider(Models.UpdateNodeProvider arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "update_node_provider", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "update_node_provider", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap index b5c2d6ce..231ee188 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; @@ -11,152 +12,154 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity Identity { get; set; } public CandidConverter Converter { get; } - public GovernanceApiClient(IAgent agent, Principal canisterId, CandidConverter converter = default) + public GovernanceApiClient(IAgent agent, Principal canisterId, IIdentity identity = default, CandidConverter converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task claim_gtc_neurons(Principal arg0, List arg1) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "claim_gtc_neurons", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "claim_gtc_neurons", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task claim_or_refresh_neuron_from_account(Models.ClaimOrRefreshNeuronFromAccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "claim_or_refresh_neuron_from_account", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "claim_or_refresh_neuron_from_account", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task _get_build_metadata() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_build_metadata", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_build_metadata", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task _get_full_neuron(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task _get_full_neuron_by_id_or_subaccount(Models.NeuronIdOrSubaccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron_by_id_or_subaccount", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron_by_id_or_subaccount", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task _get_monthly_node_provider_rewards() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "get_monthly_node_provider_rewards", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "get_monthly_node_provider_rewards", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task _get_network_economics_parameters() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_network_economics_parameters", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_network_economics_parameters", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task> _get_neuron_ids() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_ids", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_ids", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task _get_neuron_info(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task _get_neuron_info_by_id_or_subaccount(Models.NeuronIdOrSubaccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info_by_id_or_subaccount", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info_by_id_or_subaccount", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task _get_node_provider_by_caller(NullValue arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_node_provider_by_caller", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_node_provider_by_caller", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task> _get_pending_proposals() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_pending_proposals", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_pending_proposals", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task> _get_proposal_info(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_proposal_info", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_proposal_info", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task list_known_neurons() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_known_neurons", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_known_neurons", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task list_neurons(Models.ListNeurons arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_neurons", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_neurons", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task list_node_providers() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_node_providers", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_node_providers", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task list_proposals(Models.ListProposalInfo arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_proposals", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_proposals", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task manage_neuron(Models.ManageNeuron arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "manage_neuron", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "manage_neuron", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task transfer_gtc_neuron(Models.NeuronId arg0, Models.NeuronId arg1) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "transfer_gtc_neuron", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "transfer_gtc_neuron", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task update_node_provider(Models.UpdateNodeProvider arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "update_node_provider", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "update_node_provider", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap index 026780ff..5330f0d6 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; @@ -11,152 +12,154 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity Identity { get; set; } public CandidConverter Converter { get; } - public GovernanceApiClient(IAgent agent, Principal canisterId, CandidConverter converter = default) + public GovernanceApiClient(IAgent agent, Principal canisterId, IIdentity identity = default, CandidConverter converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task claim_gtc_neurons(Principal arg0, List arg1) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "claim_gtc_neurons", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "claim_gtc_neurons", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task claim_or_refresh_neuron_from_account(Models.ClaimOrRefreshNeuronFromAccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "claim_or_refresh_neuron_from_account", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "claim_or_refresh_neuron_from_account", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task _get_build_metadata() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_build_metadata", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_build_metadata", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task _get_full_neuron(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task _get_full_neuron_by_id_or_subaccount(Models.NeuronIdOrSubaccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron_by_id_or_subaccount", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron_by_id_or_subaccount", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task _get_monthly_node_provider_rewards() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "get_monthly_node_provider_rewards", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "get_monthly_node_provider_rewards", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task _get_network_economics_parameters() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_network_economics_parameters", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_network_economics_parameters", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task> _get_neuron_ids() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_ids", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_ids", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task _get_neuron_info(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task _get_neuron_info_by_id_or_subaccount(Models.NeuronIdOrSubaccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info_by_id_or_subaccount", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info_by_id_or_subaccount", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task _get_node_provider_by_caller(NullValue arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_node_provider_by_caller", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_node_provider_by_caller", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task> _get_pending_proposals() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_pending_proposals", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_pending_proposals", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task> _get_proposal_info(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_proposal_info", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_proposal_info", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task list_known_neurons() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_known_neurons", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_known_neurons", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task list_neurons(Models.ListNeurons arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_neurons", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_neurons", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task list_node_providers() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_node_providers", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_node_providers", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task list_proposals(Models.ListProposalInfo arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_proposals", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_proposals", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task manage_neuron(Models.ManageNeuron arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "manage_neuron", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "manage_neuron", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task transfer_gtc_neuron(Models.NeuronId arg0, Models.NeuronId arg1) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "transfer_gtc_neuron", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "transfer_gtc_neuron", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task update_node_provider(Models.UpdateNodeProvider arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "update_node_provider", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "update_node_provider", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap index 4e9e35d8..9401d5dd 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; @@ -11,152 +12,154 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity Identity { get; set; } public CandidConverter Converter { get; } - public GovernanceApiClient(IAgent agent, Principal canisterId, CandidConverter converter = default) + public GovernanceApiClient(IAgent agent, Principal canisterId, IIdentity identity = default, CandidConverter converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task claim_gtc_neurons(Principal arg0, List arg1) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "claim_gtc_neurons", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "claim_gtc_neurons", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task claim_or_refresh_neuron_from_account(Models.ClaimOrRefreshNeuronFromAccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "claim_or_refresh_neuron_from_account", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "claim_or_refresh_neuron_from_account", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task _get_build_metadata() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_build_metadata", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_build_metadata", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task _get_full_neuron(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task _get_full_neuron_by_id_or_subaccount(Models.NeuronIdOrSubaccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron_by_id_or_subaccount", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron_by_id_or_subaccount", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task _get_monthly_node_provider_rewards() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "get_monthly_node_provider_rewards", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "get_monthly_node_provider_rewards", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task _get_network_economics_parameters() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_network_economics_parameters", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_network_economics_parameters", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task> _get_neuron_ids() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_ids", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_ids", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task _get_neuron_info(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task _get_neuron_info_by_id_or_subaccount(Models.NeuronIdOrSubaccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info_by_id_or_subaccount", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info_by_id_or_subaccount", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task _get_node_provider_by_caller(NullValue arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_node_provider_by_caller", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_node_provider_by_caller", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task> _get_pending_proposals() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_pending_proposals", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_pending_proposals", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task> _get_proposal_info(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_proposal_info", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_proposal_info", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task list_known_neurons() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_known_neurons", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_known_neurons", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task list_neurons(Models.ListNeurons arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_neurons", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_neurons", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task list_node_providers() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_node_providers", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_node_providers", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task list_proposals(Models.ListProposalInfo arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_proposals", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_proposals", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task manage_neuron(Models.ManageNeuron arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "manage_neuron", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "manage_neuron", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task transfer_gtc_neuron(Models.NeuronId arg0, Models.NeuronId arg1) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "transfer_gtc_neuron", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "transfer_gtc_neuron", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task update_node_provider(Models.UpdateNodeProvider arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "update_node_provider", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "update_node_provider", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap index 58d15a54..e9b65b80 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; @@ -11,152 +12,154 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity Identity { get; set; } public CandidConverter Converter { get; } - public GovernanceApiClient(IAgent agent, Principal canisterId, CandidConverter converter = default) + public GovernanceApiClient(IAgent agent, Principal canisterId, IIdentity identity = default, CandidConverter converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task claim_gtc_neurons(Principal arg0, List arg1) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "claim_gtc_neurons", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "claim_gtc_neurons", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task claim_or_refresh_neuron_from_account(Models.ClaimOrRefreshNeuronFromAccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "claim_or_refresh_neuron_from_account", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "claim_or_refresh_neuron_from_account", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task _get_build_metadata() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_build_metadata", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_build_metadata", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task _get_full_neuron(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task _get_full_neuron_by_id_or_subaccount(Models.NeuronIdOrSubaccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron_by_id_or_subaccount", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron_by_id_or_subaccount", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task _get_monthly_node_provider_rewards() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "get_monthly_node_provider_rewards", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "get_monthly_node_provider_rewards", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task _get_network_economics_parameters() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_network_economics_parameters", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_network_economics_parameters", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task> _get_neuron_ids() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_ids", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_ids", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task _get_neuron_info(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task _get_neuron_info_by_id_or_subaccount(Models.NeuronIdOrSubaccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info_by_id_or_subaccount", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info_by_id_or_subaccount", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task _get_node_provider_by_caller(NullValue arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_node_provider_by_caller", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_node_provider_by_caller", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task> _get_pending_proposals() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_pending_proposals", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_pending_proposals", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task> _get_proposal_info(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_proposal_info", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_proposal_info", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task list_known_neurons() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_known_neurons", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_known_neurons", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task list_neurons(Models.ListNeurons arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_neurons", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_neurons", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task list_node_providers() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_node_providers", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_node_providers", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task list_proposals(Models.ListProposalInfo arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_proposals", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_proposals", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task manage_neuron(Models.ManageNeuron arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "manage_neuron", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "manage_neuron", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task transfer_gtc_neuron(Models.NeuronId arg0, Models.NeuronId arg1) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "transfer_gtc_neuron", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "transfer_gtc_neuron", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task update_node_provider(Models.UpdateNodeProvider arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "update_node_provider", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "update_node_provider", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap index f7d825c7..4c545e4b 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; @@ -11,152 +12,154 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity? Identity { get; set; } public CandidConverter? Converter { get; } - public GovernanceApiClient(IAgent agent, Principal canisterId, CandidConverter? converter = default) + public GovernanceApiClient(IAgent agent, Principal canisterId, IIdentity? identity = default, CandidConverter? converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task ClaimGtcNeurons(Principal arg0, List arg1) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "claim_gtc_neurons", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "claim_gtc_neurons", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task ClaimOrRefreshNeuronFromAccount(Models.ClaimOrRefreshNeuronFromAccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "claim_or_refresh_neuron_from_account", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "claim_or_refresh_neuron_from_account", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task GetBuildMetadata() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_build_metadata", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_build_metadata", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task GetFullNeuron(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task GetFullNeuronByIdOrSubaccount(Models.NeuronIdOrSubaccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron_by_id_or_subaccount", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron_by_id_or_subaccount", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task GetMonthlyNodeProviderRewards() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "get_monthly_node_provider_rewards", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "get_monthly_node_provider_rewards", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task GetNetworkEconomicsParameters() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_network_economics_parameters", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_network_economics_parameters", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task> GetNeuronIds() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_ids", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_ids", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task GetNeuronInfo(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task GetNeuronInfoByIdOrSubaccount(Models.NeuronIdOrSubaccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info_by_id_or_subaccount", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info_by_id_or_subaccount", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task GetNodeProviderByCaller(NullValue arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_node_provider_by_caller", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_node_provider_by_caller", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task> GetPendingProposals() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_pending_proposals", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_pending_proposals", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task> GetProposalInfo(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_proposal_info", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_proposal_info", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task ListKnownNeurons() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_known_neurons", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_known_neurons", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task ListNeurons(Models.ListNeurons arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_neurons", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_neurons", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task ListNodeProviders() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_node_providers", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_node_providers", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task ListProposals(Models.ListProposalInfo arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_proposals", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_proposals", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task ManageNeuron(Models.ManageNeuron arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "manage_neuron", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "manage_neuron", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task TransferGtcNeuron(Models.NeuronId arg0, Models.NeuronId arg1) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "transfer_gtc_neuron", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "transfer_gtc_neuron", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task UpdateNodeProvider(Models.UpdateNodeProvider arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "update_node_provider", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "update_node_provider", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap index feb276fa..4ac58615 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; @@ -11,152 +12,154 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity? Identity { get; set; } public CandidConverter? Converter { get; } - public GovernanceApiClient(IAgent agent, Principal canisterId, CandidConverter? converter = default) + public GovernanceApiClient(IAgent agent, Principal canisterId, IIdentity? identity = default, CandidConverter? converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task ClaimGtcNeurons(Principal arg0, List arg1) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "claim_gtc_neurons", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "claim_gtc_neurons", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task ClaimOrRefreshNeuronFromAccount(Models.ClaimOrRefreshNeuronFromAccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "claim_or_refresh_neuron_from_account", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "claim_or_refresh_neuron_from_account", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task GetBuildMetadata() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_build_metadata", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_build_metadata", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task GetFullNeuron(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task GetFullNeuronByIdOrSubaccount(Models.NeuronIdOrSubaccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron_by_id_or_subaccount", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron_by_id_or_subaccount", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task GetMonthlyNodeProviderRewards() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "get_monthly_node_provider_rewards", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "get_monthly_node_provider_rewards", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task GetNetworkEconomicsParameters() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_network_economics_parameters", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_network_economics_parameters", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task> GetNeuronIds() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_ids", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_ids", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task GetNeuronInfo(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task GetNeuronInfoByIdOrSubaccount(Models.NeuronIdOrSubaccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info_by_id_or_subaccount", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info_by_id_or_subaccount", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task GetNodeProviderByCaller(NullValue arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_node_provider_by_caller", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_node_provider_by_caller", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task> GetPendingProposals() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_pending_proposals", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_pending_proposals", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task> GetProposalInfo(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_proposal_info", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_proposal_info", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task ListKnownNeurons() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_known_neurons", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_known_neurons", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task ListNeurons(Models.ListNeurons arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_neurons", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_neurons", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task ListNodeProviders() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_node_providers", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_node_providers", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task ListProposals(Models.ListProposalInfo arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_proposals", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_proposals", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task ManageNeuron(Models.ManageNeuron arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "manage_neuron", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "manage_neuron", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task TransferGtcNeuron(Models.NeuronId arg0, Models.NeuronId arg1) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "transfer_gtc_neuron", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "transfer_gtc_neuron", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task UpdateNodeProvider(Models.UpdateNodeProvider arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "update_node_provider", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "update_node_provider", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap index 428020b1..a6dd7303 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; @@ -11,152 +12,154 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity? Identity { get; set; } public CandidConverter? Converter { get; } - public GovernanceApiClient(IAgent agent, Principal canisterId, CandidConverter? converter = default) + public GovernanceApiClient(IAgent agent, Principal canisterId, IIdentity? identity = default, CandidConverter? converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task ClaimGtcNeurons(Principal arg0, List arg1) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "claim_gtc_neurons", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "claim_gtc_neurons", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task ClaimOrRefreshNeuronFromAccount(Models.ClaimOrRefreshNeuronFromAccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "claim_or_refresh_neuron_from_account", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "claim_or_refresh_neuron_from_account", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task GetBuildMetadata() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_build_metadata", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_build_metadata", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task GetFullNeuron(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task GetFullNeuronByIdOrSubaccount(Models.NeuronIdOrSubaccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron_by_id_or_subaccount", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron_by_id_or_subaccount", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task GetMonthlyNodeProviderRewards() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "get_monthly_node_provider_rewards", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "get_monthly_node_provider_rewards", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task GetNetworkEconomicsParameters() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_network_economics_parameters", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_network_economics_parameters", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task> GetNeuronIds() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_ids", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_ids", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task GetNeuronInfo(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task GetNeuronInfoByIdOrSubaccount(Models.NeuronIdOrSubaccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info_by_id_or_subaccount", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info_by_id_or_subaccount", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task GetNodeProviderByCaller(NullValue arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_node_provider_by_caller", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_node_provider_by_caller", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task> GetPendingProposals() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_pending_proposals", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_pending_proposals", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task> GetProposalInfo(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_proposal_info", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_proposal_info", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task ListKnownNeurons() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_known_neurons", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_known_neurons", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task ListNeurons(Models.ListNeurons arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_neurons", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_neurons", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task ListNodeProviders() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_node_providers", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_node_providers", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task ListProposals(Models.ListProposalInfo arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_proposals", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_proposals", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task ManageNeuron(Models.ManageNeuron arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "manage_neuron", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "manage_neuron", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task TransferGtcNeuron(Models.NeuronId arg0, Models.NeuronId arg1) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "transfer_gtc_neuron", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "transfer_gtc_neuron", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task UpdateNodeProvider(Models.UpdateNodeProvider arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "update_node_provider", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "update_node_provider", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap index df7ada26..28726bc3 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; @@ -11,152 +12,154 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity? Identity { get; set; } public CandidConverter? Converter { get; } - public GovernanceApiClient(IAgent agent, Principal canisterId, CandidConverter? converter = default) + public GovernanceApiClient(IAgent agent, Principal canisterId, IIdentity? identity = default, CandidConverter? converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task ClaimGtcNeurons(Principal arg0, List arg1) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "claim_gtc_neurons", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "claim_gtc_neurons", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task ClaimOrRefreshNeuronFromAccount(Models.ClaimOrRefreshNeuronFromAccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "claim_or_refresh_neuron_from_account", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "claim_or_refresh_neuron_from_account", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task GetBuildMetadata() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_build_metadata", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_build_metadata", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task GetFullNeuron(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task GetFullNeuronByIdOrSubaccount(Models.NeuronIdOrSubaccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron_by_id_or_subaccount", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron_by_id_or_subaccount", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task GetMonthlyNodeProviderRewards() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "get_monthly_node_provider_rewards", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "get_monthly_node_provider_rewards", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task GetNetworkEconomicsParameters() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_network_economics_parameters", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_network_economics_parameters", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task> GetNeuronIds() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_ids", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_ids", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task GetNeuronInfo(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task GetNeuronInfoByIdOrSubaccount(Models.NeuronIdOrSubaccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info_by_id_or_subaccount", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info_by_id_or_subaccount", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task GetNodeProviderByCaller(NullValue arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_node_provider_by_caller", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_node_provider_by_caller", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task> GetPendingProposals() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_pending_proposals", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_pending_proposals", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task> GetProposalInfo(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_proposal_info", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_proposal_info", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task ListKnownNeurons() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_known_neurons", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_known_neurons", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task ListNeurons(Models.ListNeurons arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_neurons", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_neurons", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task ListNodeProviders() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_node_providers", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_node_providers", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task ListProposals(Models.ListProposalInfo arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_proposals", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_proposals", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task ManageNeuron(Models.ManageNeuron arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "manage_neuron", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "manage_neuron", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task TransferGtcNeuron(Models.NeuronId arg0, Models.NeuronId arg1) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "transfer_gtc_neuron", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "transfer_gtc_neuron", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task UpdateNodeProvider(Models.UpdateNodeProvider arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "update_node_provider", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "update_node_provider", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap index 340417e7..a23fc8cd 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; @@ -11,152 +12,154 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity? Identity { get; set; } public CandidConverter? Converter { get; } - public GovernanceApiClient(IAgent agent, Principal canisterId, CandidConverter? converter = default) + public GovernanceApiClient(IAgent agent, Principal canisterId, IIdentity? identity = default, CandidConverter? converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task claim_gtc_neurons(Principal arg0, List arg1) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "claim_gtc_neurons", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "claim_gtc_neurons", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task claim_or_refresh_neuron_from_account(Models.ClaimOrRefreshNeuronFromAccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "claim_or_refresh_neuron_from_account", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "claim_or_refresh_neuron_from_account", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task _get_build_metadata() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_build_metadata", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_build_metadata", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task _get_full_neuron(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task _get_full_neuron_by_id_or_subaccount(Models.NeuronIdOrSubaccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron_by_id_or_subaccount", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron_by_id_or_subaccount", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task _get_monthly_node_provider_rewards() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "get_monthly_node_provider_rewards", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "get_monthly_node_provider_rewards", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task _get_network_economics_parameters() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_network_economics_parameters", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_network_economics_parameters", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task> _get_neuron_ids() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_ids", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_ids", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task _get_neuron_info(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task _get_neuron_info_by_id_or_subaccount(Models.NeuronIdOrSubaccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info_by_id_or_subaccount", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info_by_id_or_subaccount", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task _get_node_provider_by_caller(NullValue arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_node_provider_by_caller", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_node_provider_by_caller", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task> _get_pending_proposals() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_pending_proposals", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_pending_proposals", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task> _get_proposal_info(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_proposal_info", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_proposal_info", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task list_known_neurons() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_known_neurons", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_known_neurons", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task list_neurons(Models.ListNeurons arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_neurons", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_neurons", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task list_node_providers() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_node_providers", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_node_providers", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task list_proposals(Models.ListProposalInfo arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_proposals", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_proposals", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task manage_neuron(Models.ManageNeuron arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "manage_neuron", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "manage_neuron", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task transfer_gtc_neuron(Models.NeuronId arg0, Models.NeuronId arg1) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "transfer_gtc_neuron", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "transfer_gtc_neuron", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task update_node_provider(Models.UpdateNodeProvider arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "update_node_provider", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "update_node_provider", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap index dc44fe44..e0b7f68a 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; @@ -11,152 +12,154 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity? Identity { get; set; } public CandidConverter? Converter { get; } - public GovernanceApiClient(IAgent agent, Principal canisterId, CandidConverter? converter = default) + public GovernanceApiClient(IAgent agent, Principal canisterId, IIdentity? identity = default, CandidConverter? converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task claim_gtc_neurons(Principal arg0, List arg1) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "claim_gtc_neurons", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "claim_gtc_neurons", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task claim_or_refresh_neuron_from_account(Models.ClaimOrRefreshNeuronFromAccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "claim_or_refresh_neuron_from_account", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "claim_or_refresh_neuron_from_account", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task _get_build_metadata() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_build_metadata", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_build_metadata", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task _get_full_neuron(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task _get_full_neuron_by_id_or_subaccount(Models.NeuronIdOrSubaccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron_by_id_or_subaccount", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron_by_id_or_subaccount", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task _get_monthly_node_provider_rewards() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "get_monthly_node_provider_rewards", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "get_monthly_node_provider_rewards", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task _get_network_economics_parameters() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_network_economics_parameters", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_network_economics_parameters", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task> _get_neuron_ids() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_ids", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_ids", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task _get_neuron_info(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task _get_neuron_info_by_id_or_subaccount(Models.NeuronIdOrSubaccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info_by_id_or_subaccount", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info_by_id_or_subaccount", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task _get_node_provider_by_caller(NullValue arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_node_provider_by_caller", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_node_provider_by_caller", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task> _get_pending_proposals() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_pending_proposals", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_pending_proposals", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task> _get_proposal_info(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_proposal_info", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_proposal_info", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task list_known_neurons() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_known_neurons", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_known_neurons", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task list_neurons(Models.ListNeurons arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_neurons", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_neurons", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task list_node_providers() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_node_providers", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_node_providers", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task list_proposals(Models.ListProposalInfo arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_proposals", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_proposals", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task manage_neuron(Models.ManageNeuron arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "manage_neuron", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "manage_neuron", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task transfer_gtc_neuron(Models.NeuronId arg0, Models.NeuronId arg1) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "transfer_gtc_neuron", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "transfer_gtc_neuron", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task update_node_provider(Models.UpdateNodeProvider arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "update_node_provider", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "update_node_provider", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap index 86dba914..8f79b28f 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; @@ -11,152 +12,154 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity? Identity { get; set; } public CandidConverter? Converter { get; } - public GovernanceApiClient(IAgent agent, Principal canisterId, CandidConverter? converter = default) + public GovernanceApiClient(IAgent agent, Principal canisterId, IIdentity? identity = default, CandidConverter? converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task claim_gtc_neurons(Principal arg0, List arg1) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "claim_gtc_neurons", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "claim_gtc_neurons", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task claim_or_refresh_neuron_from_account(Models.ClaimOrRefreshNeuronFromAccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "claim_or_refresh_neuron_from_account", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "claim_or_refresh_neuron_from_account", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task _get_build_metadata() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_build_metadata", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_build_metadata", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task _get_full_neuron(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task _get_full_neuron_by_id_or_subaccount(Models.NeuronIdOrSubaccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron_by_id_or_subaccount", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron_by_id_or_subaccount", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task _get_monthly_node_provider_rewards() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "get_monthly_node_provider_rewards", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "get_monthly_node_provider_rewards", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task _get_network_economics_parameters() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_network_economics_parameters", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_network_economics_parameters", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task> _get_neuron_ids() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_ids", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_ids", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task _get_neuron_info(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task _get_neuron_info_by_id_or_subaccount(Models.NeuronIdOrSubaccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info_by_id_or_subaccount", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info_by_id_or_subaccount", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task _get_node_provider_by_caller(NullValue arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_node_provider_by_caller", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_node_provider_by_caller", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task> _get_pending_proposals() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_pending_proposals", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_pending_proposals", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task> _get_proposal_info(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_proposal_info", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_proposal_info", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task list_known_neurons() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_known_neurons", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_known_neurons", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task list_neurons(Models.ListNeurons arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_neurons", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_neurons", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task list_node_providers() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_node_providers", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_node_providers", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task list_proposals(Models.ListProposalInfo arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_proposals", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_proposals", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task manage_neuron(Models.ManageNeuron arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "manage_neuron", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "manage_neuron", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task transfer_gtc_neuron(Models.NeuronId arg0, Models.NeuronId arg1) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "transfer_gtc_neuron", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "transfer_gtc_neuron", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task update_node_provider(Models.UpdateNodeProvider arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "update_node_provider", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "update_node_provider", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap index 2e46e593..8f48cf77 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; @@ -11,152 +12,154 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity? Identity { get; set; } public CandidConverter? Converter { get; } - public GovernanceApiClient(IAgent agent, Principal canisterId, CandidConverter? converter = default) + public GovernanceApiClient(IAgent agent, Principal canisterId, IIdentity? identity = default, CandidConverter? converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task claim_gtc_neurons(Principal arg0, List arg1) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "claim_gtc_neurons", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "claim_gtc_neurons", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task claim_or_refresh_neuron_from_account(Models.ClaimOrRefreshNeuronFromAccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "claim_or_refresh_neuron_from_account", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "claim_or_refresh_neuron_from_account", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task _get_build_metadata() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_build_metadata", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_build_metadata", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task _get_full_neuron(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task _get_full_neuron_by_id_or_subaccount(Models.NeuronIdOrSubaccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron_by_id_or_subaccount", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron_by_id_or_subaccount", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task _get_monthly_node_provider_rewards() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "get_monthly_node_provider_rewards", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "get_monthly_node_provider_rewards", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task _get_network_economics_parameters() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_network_economics_parameters", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_network_economics_parameters", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task> _get_neuron_ids() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_ids", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_ids", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task _get_neuron_info(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task _get_neuron_info_by_id_or_subaccount(Models.NeuronIdOrSubaccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info_by_id_or_subaccount", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info_by_id_or_subaccount", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task _get_node_provider_by_caller(NullValue arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_node_provider_by_caller", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_node_provider_by_caller", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task> _get_pending_proposals() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_pending_proposals", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_pending_proposals", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task> _get_proposal_info(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_proposal_info", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_proposal_info", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task list_known_neurons() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_known_neurons", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_known_neurons", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task list_neurons(Models.ListNeurons arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_neurons", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_neurons", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task list_node_providers() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_node_providers", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_node_providers", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task list_proposals(Models.ListProposalInfo arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_proposals", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_proposals", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task manage_neuron(Models.ManageNeuron arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "manage_neuron", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "manage_neuron", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task transfer_gtc_neuron(Models.NeuronId arg0, Models.NeuronId arg1) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "transfer_gtc_neuron", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "transfer_gtc_neuron", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task update_node_provider(Models.UpdateNodeProvider arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "update_node_provider", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "update_node_provider", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap index 1d8f6f02..67a82b44 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; @@ -11,152 +12,154 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity Identity { get; set; } public CandidConverter Converter { get; } - public GovernanceApiClient(IAgent agent, Principal canisterId, CandidConverter converter = default) + public GovernanceApiClient(IAgent agent, Principal canisterId, IIdentity identity = default, CandidConverter converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task ClaimGtcNeurons(Principal arg0, List arg1) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "claim_gtc_neurons", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "claim_gtc_neurons", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task ClaimOrRefreshNeuronFromAccount(ClaimOrRefreshNeuronFromAccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "claim_or_refresh_neuron_from_account", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "claim_or_refresh_neuron_from_account", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task GetBuildMetadata() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_build_metadata", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_build_metadata", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task GetFullNeuron(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task GetFullNeuronByIdOrSubaccount(NeuronIdOrSubaccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron_by_id_or_subaccount", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron_by_id_or_subaccount", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task GetMonthlyNodeProviderRewards() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "get_monthly_node_provider_rewards", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "get_monthly_node_provider_rewards", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task GetNetworkEconomicsParameters() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_network_economics_parameters", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_network_economics_parameters", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task> GetNeuronIds() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_ids", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_ids", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task GetNeuronInfo(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task GetNeuronInfoByIdOrSubaccount(NeuronIdOrSubaccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info_by_id_or_subaccount", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info_by_id_or_subaccount", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task GetNodeProviderByCaller(NullValue arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_node_provider_by_caller", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_node_provider_by_caller", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task> GetPendingProposals() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_pending_proposals", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_pending_proposals", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task> GetProposalInfo(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_proposal_info", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_proposal_info", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task ListKnownNeurons() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_known_neurons", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_known_neurons", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task ListNeurons(ListNeurons arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_neurons", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_neurons", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task ListNodeProviders() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_node_providers", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_node_providers", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task ListProposals(ListProposalInfo arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_proposals", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_proposals", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task ManageNeuron(ManageNeuron arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "manage_neuron", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "manage_neuron", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task TransferGtcNeuron(NeuronId arg0, NeuronId arg1) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "transfer_gtc_neuron", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "transfer_gtc_neuron", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task UpdateNodeProvider(UpdateNodeProvider arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "update_node_provider", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "update_node_provider", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap index 72fbf4c6..3120031b 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; @@ -11,152 +12,154 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity Identity { get; set; } public CandidConverter Converter { get; } - public GovernanceApiClient(IAgent agent, Principal canisterId, CandidConverter converter = default) + public GovernanceApiClient(IAgent agent, Principal canisterId, IIdentity identity = default, CandidConverter converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task ClaimGtcNeurons(Principal arg0, List arg1) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "claim_gtc_neurons", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "claim_gtc_neurons", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task ClaimOrRefreshNeuronFromAccount(ClaimOrRefreshNeuronFromAccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "claim_or_refresh_neuron_from_account", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "claim_or_refresh_neuron_from_account", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task GetBuildMetadata() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_build_metadata", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_build_metadata", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task GetFullNeuron(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task GetFullNeuronByIdOrSubaccount(NeuronIdOrSubaccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron_by_id_or_subaccount", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron_by_id_or_subaccount", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task GetMonthlyNodeProviderRewards() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "get_monthly_node_provider_rewards", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "get_monthly_node_provider_rewards", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task GetNetworkEconomicsParameters() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_network_economics_parameters", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_network_economics_parameters", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task> GetNeuronIds() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_ids", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_ids", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task GetNeuronInfo(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task GetNeuronInfoByIdOrSubaccount(NeuronIdOrSubaccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info_by_id_or_subaccount", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info_by_id_or_subaccount", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task GetNodeProviderByCaller(NullValue arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_node_provider_by_caller", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_node_provider_by_caller", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task> GetPendingProposals() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_pending_proposals", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_pending_proposals", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task> GetProposalInfo(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_proposal_info", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_proposal_info", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task ListKnownNeurons() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_known_neurons", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_known_neurons", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task ListNeurons(ListNeurons arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_neurons", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_neurons", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task ListNodeProviders() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_node_providers", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_node_providers", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task ListProposals(ListProposalInfo arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_proposals", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_proposals", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task ManageNeuron(ManageNeuron arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "manage_neuron", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "manage_neuron", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task TransferGtcNeuron(NeuronId arg0, NeuronId arg1) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "transfer_gtc_neuron", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "transfer_gtc_neuron", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task UpdateNodeProvider(UpdateNodeProvider arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "update_node_provider", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "update_node_provider", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap index ecf3e1d4..f41d0753 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; @@ -11,152 +12,154 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity Identity { get; set; } public CandidConverter Converter { get; } - public GovernanceApiClient(IAgent agent, Principal canisterId, CandidConverter converter = default) + public GovernanceApiClient(IAgent agent, Principal canisterId, IIdentity identity = default, CandidConverter converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task ClaimGtcNeurons(Principal arg0, List arg1) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "claim_gtc_neurons", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "claim_gtc_neurons", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task ClaimOrRefreshNeuronFromAccount(ClaimOrRefreshNeuronFromAccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "claim_or_refresh_neuron_from_account", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "claim_or_refresh_neuron_from_account", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task GetBuildMetadata() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_build_metadata", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_build_metadata", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task GetFullNeuron(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task GetFullNeuronByIdOrSubaccount(NeuronIdOrSubaccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron_by_id_or_subaccount", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron_by_id_or_subaccount", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task GetMonthlyNodeProviderRewards() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "get_monthly_node_provider_rewards", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "get_monthly_node_provider_rewards", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task GetNetworkEconomicsParameters() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_network_economics_parameters", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_network_economics_parameters", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task> GetNeuronIds() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_ids", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_ids", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task GetNeuronInfo(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task GetNeuronInfoByIdOrSubaccount(NeuronIdOrSubaccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info_by_id_or_subaccount", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info_by_id_or_subaccount", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task GetNodeProviderByCaller(NullValue arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_node_provider_by_caller", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_node_provider_by_caller", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task> GetPendingProposals() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_pending_proposals", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_pending_proposals", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task> GetProposalInfo(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_proposal_info", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_proposal_info", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task ListKnownNeurons() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_known_neurons", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_known_neurons", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task ListNeurons(ListNeurons arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_neurons", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_neurons", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task ListNodeProviders() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_node_providers", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_node_providers", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task ListProposals(ListProposalInfo arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_proposals", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_proposals", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task ManageNeuron(ManageNeuron arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "manage_neuron", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "manage_neuron", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task TransferGtcNeuron(NeuronId arg0, NeuronId arg1) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "transfer_gtc_neuron", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "transfer_gtc_neuron", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task UpdateNodeProvider(UpdateNodeProvider arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "update_node_provider", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "update_node_provider", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap index 10b3d435..885b4b17 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; @@ -11,152 +12,154 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity Identity { get; set; } public CandidConverter Converter { get; } - public GovernanceApiClient(IAgent agent, Principal canisterId, CandidConverter converter = default) + public GovernanceApiClient(IAgent agent, Principal canisterId, IIdentity identity = default, CandidConverter converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task ClaimGtcNeurons(Principal arg0, List arg1) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "claim_gtc_neurons", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "claim_gtc_neurons", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task ClaimOrRefreshNeuronFromAccount(ClaimOrRefreshNeuronFromAccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "claim_or_refresh_neuron_from_account", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "claim_or_refresh_neuron_from_account", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task GetBuildMetadata() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_build_metadata", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_build_metadata", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task GetFullNeuron(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task GetFullNeuronByIdOrSubaccount(NeuronIdOrSubaccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron_by_id_or_subaccount", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron_by_id_or_subaccount", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task GetMonthlyNodeProviderRewards() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "get_monthly_node_provider_rewards", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "get_monthly_node_provider_rewards", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task GetNetworkEconomicsParameters() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_network_economics_parameters", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_network_economics_parameters", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task> GetNeuronIds() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_ids", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_ids", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task GetNeuronInfo(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task GetNeuronInfoByIdOrSubaccount(NeuronIdOrSubaccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info_by_id_or_subaccount", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info_by_id_or_subaccount", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task GetNodeProviderByCaller(NullValue arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_node_provider_by_caller", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_node_provider_by_caller", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task> GetPendingProposals() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_pending_proposals", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_pending_proposals", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task> GetProposalInfo(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_proposal_info", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_proposal_info", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task ListKnownNeurons() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_known_neurons", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_known_neurons", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task ListNeurons(ListNeurons arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_neurons", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_neurons", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task ListNodeProviders() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_node_providers", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_node_providers", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task ListProposals(ListProposalInfo arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_proposals", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_proposals", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task ManageNeuron(ManageNeuron arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "manage_neuron", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "manage_neuron", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task TransferGtcNeuron(NeuronId arg0, NeuronId arg1) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "transfer_gtc_neuron", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "transfer_gtc_neuron", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task UpdateNodeProvider(UpdateNodeProvider arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "update_node_provider", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "update_node_provider", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap index b296b63e..9dd4b116 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; @@ -11,152 +12,154 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity Identity { get; set; } public CandidConverter Converter { get; } - public GovernanceApiClient(IAgent agent, Principal canisterId, CandidConverter converter = default) + public GovernanceApiClient(IAgent agent, Principal canisterId, IIdentity identity = default, CandidConverter converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task claim_gtc_neurons(Principal arg0, List arg1) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "claim_gtc_neurons", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "claim_gtc_neurons", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task claim_or_refresh_neuron_from_account(ClaimOrRefreshNeuronFromAccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "claim_or_refresh_neuron_from_account", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "claim_or_refresh_neuron_from_account", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task _get_build_metadata() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_build_metadata", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_build_metadata", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task _get_full_neuron(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task _get_full_neuron_by_id_or_subaccount(NeuronIdOrSubaccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron_by_id_or_subaccount", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron_by_id_or_subaccount", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task _get_monthly_node_provider_rewards() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "get_monthly_node_provider_rewards", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "get_monthly_node_provider_rewards", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task _get_network_economics_parameters() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_network_economics_parameters", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_network_economics_parameters", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task> _get_neuron_ids() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_ids", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_ids", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task _get_neuron_info(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task _get_neuron_info_by_id_or_subaccount(NeuronIdOrSubaccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info_by_id_or_subaccount", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info_by_id_or_subaccount", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task _get_node_provider_by_caller(NullValue arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_node_provider_by_caller", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_node_provider_by_caller", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task> _get_pending_proposals() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_pending_proposals", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_pending_proposals", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task> _get_proposal_info(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_proposal_info", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_proposal_info", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task list_known_neurons() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_known_neurons", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_known_neurons", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task list_neurons(ListNeurons arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_neurons", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_neurons", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task list_node_providers() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_node_providers", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_node_providers", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task list_proposals(ListProposalInfo arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_proposals", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_proposals", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task manage_neuron(ManageNeuron arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "manage_neuron", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "manage_neuron", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task transfer_gtc_neuron(NeuronId arg0, NeuronId arg1) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "transfer_gtc_neuron", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "transfer_gtc_neuron", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task update_node_provider(UpdateNodeProvider arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "update_node_provider", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "update_node_provider", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap index 7b8fda7a..b40ce703 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; @@ -11,152 +12,154 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity Identity { get; set; } public CandidConverter Converter { get; } - public GovernanceApiClient(IAgent agent, Principal canisterId, CandidConverter converter = default) + public GovernanceApiClient(IAgent agent, Principal canisterId, IIdentity identity = default, CandidConverter converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task claim_gtc_neurons(Principal arg0, List arg1) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "claim_gtc_neurons", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "claim_gtc_neurons", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task claim_or_refresh_neuron_from_account(ClaimOrRefreshNeuronFromAccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "claim_or_refresh_neuron_from_account", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "claim_or_refresh_neuron_from_account", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task _get_build_metadata() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_build_metadata", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_build_metadata", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task _get_full_neuron(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task _get_full_neuron_by_id_or_subaccount(NeuronIdOrSubaccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron_by_id_or_subaccount", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron_by_id_or_subaccount", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task _get_monthly_node_provider_rewards() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "get_monthly_node_provider_rewards", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "get_monthly_node_provider_rewards", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task _get_network_economics_parameters() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_network_economics_parameters", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_network_economics_parameters", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task> _get_neuron_ids() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_ids", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_ids", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task _get_neuron_info(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task _get_neuron_info_by_id_or_subaccount(NeuronIdOrSubaccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info_by_id_or_subaccount", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info_by_id_or_subaccount", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task _get_node_provider_by_caller(NullValue arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_node_provider_by_caller", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_node_provider_by_caller", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task> _get_pending_proposals() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_pending_proposals", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_pending_proposals", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task> _get_proposal_info(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_proposal_info", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_proposal_info", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task list_known_neurons() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_known_neurons", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_known_neurons", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task list_neurons(ListNeurons arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_neurons", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_neurons", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task list_node_providers() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_node_providers", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_node_providers", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task list_proposals(ListProposalInfo arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_proposals", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_proposals", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task manage_neuron(ManageNeuron arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "manage_neuron", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "manage_neuron", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task transfer_gtc_neuron(NeuronId arg0, NeuronId arg1) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "transfer_gtc_neuron", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "transfer_gtc_neuron", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task update_node_provider(UpdateNodeProvider arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "update_node_provider", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "update_node_provider", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap index 8847bb23..7957e827 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; @@ -11,152 +12,154 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity Identity { get; set; } public CandidConverter Converter { get; } - public GovernanceApiClient(IAgent agent, Principal canisterId, CandidConverter converter = default) + public GovernanceApiClient(IAgent agent, Principal canisterId, IIdentity identity = default, CandidConverter converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task claim_gtc_neurons(Principal arg0, List arg1) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "claim_gtc_neurons", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "claim_gtc_neurons", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task claim_or_refresh_neuron_from_account(ClaimOrRefreshNeuronFromAccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "claim_or_refresh_neuron_from_account", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "claim_or_refresh_neuron_from_account", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task _get_build_metadata() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_build_metadata", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_build_metadata", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task _get_full_neuron(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task _get_full_neuron_by_id_or_subaccount(NeuronIdOrSubaccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron_by_id_or_subaccount", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron_by_id_or_subaccount", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task _get_monthly_node_provider_rewards() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "get_monthly_node_provider_rewards", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "get_monthly_node_provider_rewards", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task _get_network_economics_parameters() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_network_economics_parameters", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_network_economics_parameters", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task> _get_neuron_ids() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_ids", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_ids", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task _get_neuron_info(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task _get_neuron_info_by_id_or_subaccount(NeuronIdOrSubaccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info_by_id_or_subaccount", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info_by_id_or_subaccount", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task _get_node_provider_by_caller(NullValue arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_node_provider_by_caller", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_node_provider_by_caller", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task> _get_pending_proposals() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_pending_proposals", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_pending_proposals", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task> _get_proposal_info(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_proposal_info", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_proposal_info", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task list_known_neurons() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_known_neurons", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_known_neurons", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task list_neurons(ListNeurons arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_neurons", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_neurons", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task list_node_providers() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_node_providers", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_node_providers", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task list_proposals(ListProposalInfo arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_proposals", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_proposals", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task manage_neuron(ManageNeuron arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "manage_neuron", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "manage_neuron", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task transfer_gtc_neuron(NeuronId arg0, NeuronId arg1) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "transfer_gtc_neuron", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "transfer_gtc_neuron", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task update_node_provider(UpdateNodeProvider arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "update_node_provider", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "update_node_provider", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap index 23cc8db0..36865a4e 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; @@ -11,152 +12,154 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity Identity { get; set; } public CandidConverter Converter { get; } - public GovernanceApiClient(IAgent agent, Principal canisterId, CandidConverter converter = default) + public GovernanceApiClient(IAgent agent, Principal canisterId, IIdentity identity = default, CandidConverter converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task claim_gtc_neurons(Principal arg0, List arg1) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "claim_gtc_neurons", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "claim_gtc_neurons", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task claim_or_refresh_neuron_from_account(ClaimOrRefreshNeuronFromAccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "claim_or_refresh_neuron_from_account", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "claim_or_refresh_neuron_from_account", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task _get_build_metadata() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_build_metadata", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_build_metadata", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task _get_full_neuron(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task _get_full_neuron_by_id_or_subaccount(NeuronIdOrSubaccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron_by_id_or_subaccount", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron_by_id_or_subaccount", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task _get_monthly_node_provider_rewards() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "get_monthly_node_provider_rewards", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "get_monthly_node_provider_rewards", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task _get_network_economics_parameters() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_network_economics_parameters", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_network_economics_parameters", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task> _get_neuron_ids() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_ids", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_ids", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task _get_neuron_info(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task _get_neuron_info_by_id_or_subaccount(NeuronIdOrSubaccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info_by_id_or_subaccount", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info_by_id_or_subaccount", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task _get_node_provider_by_caller(NullValue arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_node_provider_by_caller", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_node_provider_by_caller", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task> _get_pending_proposals() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_pending_proposals", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_pending_proposals", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task> _get_proposal_info(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_proposal_info", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_proposal_info", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task list_known_neurons() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_known_neurons", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_known_neurons", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task list_neurons(ListNeurons arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_neurons", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_neurons", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task list_node_providers() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_node_providers", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_node_providers", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task list_proposals(ListProposalInfo arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_proposals", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_proposals", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task manage_neuron(ManageNeuron arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "manage_neuron", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "manage_neuron", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task transfer_gtc_neuron(NeuronId arg0, NeuronId arg1) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "transfer_gtc_neuron", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "transfer_gtc_neuron", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task update_node_provider(UpdateNodeProvider arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "update_node_provider", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "update_node_provider", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap index 6e38bf41..e9696aca 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_False.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; @@ -11,152 +12,154 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity? Identity { get; set; } public CandidConverter? Converter { get; } - public GovernanceApiClient(IAgent agent, Principal canisterId, CandidConverter? converter = default) + public GovernanceApiClient(IAgent agent, Principal canisterId, IIdentity? identity = default, CandidConverter? converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task ClaimGtcNeurons(Principal arg0, List arg1) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "claim_gtc_neurons", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "claim_gtc_neurons", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task ClaimOrRefreshNeuronFromAccount(ClaimOrRefreshNeuronFromAccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "claim_or_refresh_neuron_from_account", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "claim_or_refresh_neuron_from_account", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task GetBuildMetadata() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_build_metadata", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_build_metadata", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task GetFullNeuron(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task GetFullNeuronByIdOrSubaccount(NeuronIdOrSubaccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron_by_id_or_subaccount", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron_by_id_or_subaccount", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task GetMonthlyNodeProviderRewards() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "get_monthly_node_provider_rewards", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "get_monthly_node_provider_rewards", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task GetNetworkEconomicsParameters() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_network_economics_parameters", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_network_economics_parameters", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task> GetNeuronIds() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_ids", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_ids", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task GetNeuronInfo(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task GetNeuronInfoByIdOrSubaccount(NeuronIdOrSubaccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info_by_id_or_subaccount", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info_by_id_or_subaccount", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task GetNodeProviderByCaller(NullValue arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_node_provider_by_caller", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_node_provider_by_caller", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task> GetPendingProposals() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_pending_proposals", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_pending_proposals", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task> GetProposalInfo(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_proposal_info", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_proposal_info", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task ListKnownNeurons() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_known_neurons", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_known_neurons", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task ListNeurons(ListNeurons arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_neurons", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_neurons", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task ListNodeProviders() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_node_providers", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_node_providers", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task ListProposals(ListProposalInfo arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_proposals", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_proposals", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task ManageNeuron(ManageNeuron arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "manage_neuron", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "manage_neuron", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task TransferGtcNeuron(NeuronId arg0, NeuronId arg1) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "transfer_gtc_neuron", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "transfer_gtc_neuron", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task UpdateNodeProvider(UpdateNodeProvider arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "update_node_provider", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "update_node_provider", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap index 2eb4ffc9..880624b5 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False_OverrideOptionalValue_True.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; @@ -11,152 +12,154 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity? Identity { get; set; } public CandidConverter? Converter { get; } - public GovernanceApiClient(IAgent agent, Principal canisterId, CandidConverter? converter = default) + public GovernanceApiClient(IAgent agent, Principal canisterId, IIdentity? identity = default, CandidConverter? converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task ClaimGtcNeurons(Principal arg0, List arg1) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "claim_gtc_neurons", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "claim_gtc_neurons", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task ClaimOrRefreshNeuronFromAccount(ClaimOrRefreshNeuronFromAccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "claim_or_refresh_neuron_from_account", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "claim_or_refresh_neuron_from_account", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task GetBuildMetadata() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_build_metadata", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_build_metadata", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task GetFullNeuron(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task GetFullNeuronByIdOrSubaccount(NeuronIdOrSubaccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron_by_id_or_subaccount", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron_by_id_or_subaccount", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task GetMonthlyNodeProviderRewards() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "get_monthly_node_provider_rewards", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "get_monthly_node_provider_rewards", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task GetNetworkEconomicsParameters() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_network_economics_parameters", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_network_economics_parameters", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task> GetNeuronIds() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_ids", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_ids", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task GetNeuronInfo(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task GetNeuronInfoByIdOrSubaccount(NeuronIdOrSubaccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info_by_id_or_subaccount", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info_by_id_or_subaccount", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task GetNodeProviderByCaller(NullValue arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_node_provider_by_caller", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_node_provider_by_caller", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task> GetPendingProposals() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_pending_proposals", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_pending_proposals", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task> GetProposalInfo(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_proposal_info", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_proposal_info", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task ListKnownNeurons() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_known_neurons", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_known_neurons", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task ListNeurons(ListNeurons arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_neurons", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_neurons", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task ListNodeProviders() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_node_providers", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_node_providers", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task ListProposals(ListProposalInfo arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_proposals", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_proposals", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task ManageNeuron(ManageNeuron arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "manage_neuron", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "manage_neuron", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task TransferGtcNeuron(NeuronId arg0, NeuronId arg1) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "transfer_gtc_neuron", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "transfer_gtc_neuron", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task UpdateNodeProvider(UpdateNodeProvider arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "update_node_provider", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "update_node_provider", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap index 0db501bb..31ffaa70 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_False.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; @@ -11,152 +12,154 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity? Identity { get; set; } public CandidConverter? Converter { get; } - public GovernanceApiClient(IAgent agent, Principal canisterId, CandidConverter? converter = default) + public GovernanceApiClient(IAgent agent, Principal canisterId, IIdentity? identity = default, CandidConverter? converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task ClaimGtcNeurons(Principal arg0, List arg1) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "claim_gtc_neurons", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "claim_gtc_neurons", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task ClaimOrRefreshNeuronFromAccount(ClaimOrRefreshNeuronFromAccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "claim_or_refresh_neuron_from_account", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "claim_or_refresh_neuron_from_account", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task GetBuildMetadata() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_build_metadata", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_build_metadata", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task GetFullNeuron(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task GetFullNeuronByIdOrSubaccount(NeuronIdOrSubaccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron_by_id_or_subaccount", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron_by_id_or_subaccount", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task GetMonthlyNodeProviderRewards() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "get_monthly_node_provider_rewards", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "get_monthly_node_provider_rewards", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task GetNetworkEconomicsParameters() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_network_economics_parameters", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_network_economics_parameters", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task> GetNeuronIds() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_ids", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_ids", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task GetNeuronInfo(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task GetNeuronInfoByIdOrSubaccount(NeuronIdOrSubaccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info_by_id_or_subaccount", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info_by_id_or_subaccount", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task GetNodeProviderByCaller(NullValue arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_node_provider_by_caller", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_node_provider_by_caller", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task> GetPendingProposals() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_pending_proposals", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_pending_proposals", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task> GetProposalInfo(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_proposal_info", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_proposal_info", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task ListKnownNeurons() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_known_neurons", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_known_neurons", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task ListNeurons(ListNeurons arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_neurons", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_neurons", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task ListNodeProviders() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_node_providers", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_node_providers", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task ListProposals(ListProposalInfo arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_proposals", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_proposals", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task ManageNeuron(ManageNeuron arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "manage_neuron", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "manage_neuron", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task TransferGtcNeuron(NeuronId arg0, NeuronId arg1) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "transfer_gtc_neuron", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "transfer_gtc_neuron", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task UpdateNodeProvider(UpdateNodeProvider arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "update_node_provider", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "update_node_provider", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap index 75dfe929..39467978 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True_OverrideOptionalValue_True.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; @@ -11,152 +12,154 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity? Identity { get; set; } public CandidConverter? Converter { get; } - public GovernanceApiClient(IAgent agent, Principal canisterId, CandidConverter? converter = default) + public GovernanceApiClient(IAgent agent, Principal canisterId, IIdentity? identity = default, CandidConverter? converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task ClaimGtcNeurons(Principal arg0, List arg1) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "claim_gtc_neurons", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "claim_gtc_neurons", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task ClaimOrRefreshNeuronFromAccount(ClaimOrRefreshNeuronFromAccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "claim_or_refresh_neuron_from_account", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "claim_or_refresh_neuron_from_account", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task GetBuildMetadata() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_build_metadata", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_build_metadata", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task GetFullNeuron(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task GetFullNeuronByIdOrSubaccount(NeuronIdOrSubaccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron_by_id_or_subaccount", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron_by_id_or_subaccount", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task GetMonthlyNodeProviderRewards() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "get_monthly_node_provider_rewards", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "get_monthly_node_provider_rewards", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task GetNetworkEconomicsParameters() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_network_economics_parameters", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_network_economics_parameters", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task> GetNeuronIds() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_ids", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_ids", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task GetNeuronInfo(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task GetNeuronInfoByIdOrSubaccount(NeuronIdOrSubaccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info_by_id_or_subaccount", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info_by_id_or_subaccount", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task GetNodeProviderByCaller(NullValue arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_node_provider_by_caller", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_node_provider_by_caller", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task> GetPendingProposals() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_pending_proposals", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_pending_proposals", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task> GetProposalInfo(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_proposal_info", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_proposal_info", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task ListKnownNeurons() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_known_neurons", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_known_neurons", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task ListNeurons(ListNeurons arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_neurons", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_neurons", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task ListNodeProviders() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_node_providers", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_node_providers", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task ListProposals(ListProposalInfo arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_proposals", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_proposals", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task ManageNeuron(ManageNeuron arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "manage_neuron", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "manage_neuron", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task TransferGtcNeuron(NeuronId arg0, NeuronId arg1) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "transfer_gtc_neuron", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "transfer_gtc_neuron", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task UpdateNodeProvider(UpdateNodeProvider arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "update_node_provider", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "update_node_provider", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap index 4783f13e..ef164a96 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_False.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; @@ -11,152 +12,154 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity? Identity { get; set; } public CandidConverter? Converter { get; } - public GovernanceApiClient(IAgent agent, Principal canisterId, CandidConverter? converter = default) + public GovernanceApiClient(IAgent agent, Principal canisterId, IIdentity? identity = default, CandidConverter? converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task claim_gtc_neurons(Principal arg0, List arg1) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "claim_gtc_neurons", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "claim_gtc_neurons", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task claim_or_refresh_neuron_from_account(ClaimOrRefreshNeuronFromAccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "claim_or_refresh_neuron_from_account", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "claim_or_refresh_neuron_from_account", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task _get_build_metadata() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_build_metadata", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_build_metadata", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task _get_full_neuron(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task _get_full_neuron_by_id_or_subaccount(NeuronIdOrSubaccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron_by_id_or_subaccount", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron_by_id_or_subaccount", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task _get_monthly_node_provider_rewards() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "get_monthly_node_provider_rewards", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "get_monthly_node_provider_rewards", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task _get_network_economics_parameters() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_network_economics_parameters", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_network_economics_parameters", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task> _get_neuron_ids() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_ids", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_ids", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task _get_neuron_info(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task _get_neuron_info_by_id_or_subaccount(NeuronIdOrSubaccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info_by_id_or_subaccount", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info_by_id_or_subaccount", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task _get_node_provider_by_caller(NullValue arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_node_provider_by_caller", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_node_provider_by_caller", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task> _get_pending_proposals() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_pending_proposals", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_pending_proposals", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task> _get_proposal_info(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_proposal_info", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_proposal_info", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task list_known_neurons() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_known_neurons", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_known_neurons", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task list_neurons(ListNeurons arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_neurons", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_neurons", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task list_node_providers() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_node_providers", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_node_providers", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task list_proposals(ListProposalInfo arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_proposals", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_proposals", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task manage_neuron(ManageNeuron arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "manage_neuron", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "manage_neuron", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task transfer_gtc_neuron(NeuronId arg0, NeuronId arg1) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "transfer_gtc_neuron", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "transfer_gtc_neuron", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task update_node_provider(UpdateNodeProvider arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "update_node_provider", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "update_node_provider", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap index 534c12ba..b09a1ff9 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False_OverrideOptionalValue_True.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; @@ -11,152 +12,154 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity? Identity { get; set; } public CandidConverter? Converter { get; } - public GovernanceApiClient(IAgent agent, Principal canisterId, CandidConverter? converter = default) + public GovernanceApiClient(IAgent agent, Principal canisterId, IIdentity? identity = default, CandidConverter? converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task claim_gtc_neurons(Principal arg0, List arg1) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "claim_gtc_neurons", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "claim_gtc_neurons", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task claim_or_refresh_neuron_from_account(ClaimOrRefreshNeuronFromAccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "claim_or_refresh_neuron_from_account", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "claim_or_refresh_neuron_from_account", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task _get_build_metadata() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_build_metadata", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_build_metadata", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task _get_full_neuron(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task _get_full_neuron_by_id_or_subaccount(NeuronIdOrSubaccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron_by_id_or_subaccount", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron_by_id_or_subaccount", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task _get_monthly_node_provider_rewards() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "get_monthly_node_provider_rewards", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "get_monthly_node_provider_rewards", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task _get_network_economics_parameters() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_network_economics_parameters", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_network_economics_parameters", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task> _get_neuron_ids() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_ids", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_ids", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task _get_neuron_info(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task _get_neuron_info_by_id_or_subaccount(NeuronIdOrSubaccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info_by_id_or_subaccount", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info_by_id_or_subaccount", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task _get_node_provider_by_caller(NullValue arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_node_provider_by_caller", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_node_provider_by_caller", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task> _get_pending_proposals() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_pending_proposals", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_pending_proposals", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task> _get_proposal_info(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_proposal_info", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_proposal_info", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task list_known_neurons() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_known_neurons", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_known_neurons", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task list_neurons(ListNeurons arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_neurons", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_neurons", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task list_node_providers() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_node_providers", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_node_providers", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task list_proposals(ListProposalInfo arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_proposals", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_proposals", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task manage_neuron(ManageNeuron arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "manage_neuron", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "manage_neuron", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task transfer_gtc_neuron(NeuronId arg0, NeuronId arg1) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "transfer_gtc_neuron", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "transfer_gtc_neuron", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task update_node_provider(UpdateNodeProvider arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "update_node_provider", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "update_node_provider", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap index 8c24a132..82f46eba 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_False.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; @@ -11,152 +12,154 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity? Identity { get; set; } public CandidConverter? Converter { get; } - public GovernanceApiClient(IAgent agent, Principal canisterId, CandidConverter? converter = default) + public GovernanceApiClient(IAgent agent, Principal canisterId, IIdentity? identity = default, CandidConverter? converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task claim_gtc_neurons(Principal arg0, List arg1) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "claim_gtc_neurons", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "claim_gtc_neurons", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task claim_or_refresh_neuron_from_account(ClaimOrRefreshNeuronFromAccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "claim_or_refresh_neuron_from_account", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "claim_or_refresh_neuron_from_account", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task _get_build_metadata() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_build_metadata", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_build_metadata", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task _get_full_neuron(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task _get_full_neuron_by_id_or_subaccount(NeuronIdOrSubaccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron_by_id_or_subaccount", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron_by_id_or_subaccount", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task _get_monthly_node_provider_rewards() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "get_monthly_node_provider_rewards", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "get_monthly_node_provider_rewards", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task _get_network_economics_parameters() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_network_economics_parameters", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_network_economics_parameters", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task> _get_neuron_ids() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_ids", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_ids", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task _get_neuron_info(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task _get_neuron_info_by_id_or_subaccount(NeuronIdOrSubaccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info_by_id_or_subaccount", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info_by_id_or_subaccount", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task _get_node_provider_by_caller(NullValue arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_node_provider_by_caller", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_node_provider_by_caller", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task> _get_pending_proposals() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_pending_proposals", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_pending_proposals", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task> _get_proposal_info(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_proposal_info", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_proposal_info", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task list_known_neurons() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_known_neurons", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_known_neurons", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task list_neurons(ListNeurons arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_neurons", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_neurons", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task list_node_providers() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_node_providers", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_node_providers", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task list_proposals(ListProposalInfo arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_proposals", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_proposals", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task manage_neuron(ManageNeuron arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "manage_neuron", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "manage_neuron", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task transfer_gtc_neuron(NeuronId arg0, NeuronId arg1) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "transfer_gtc_neuron", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "transfer_gtc_neuron", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task update_node_provider(UpdateNodeProvider arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "update_node_provider", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "update_node_provider", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } } diff --git a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap index a936576e..5f30c012 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True_OverrideOptionalValue_True.snap @@ -1,5 +1,6 @@ -using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Candid; using System.Threading.Tasks; using Test; @@ -11,152 +12,154 @@ namespace Test { public IAgent Agent { get; } public Principal CanisterId { get; } + public IIdentity? Identity { get; set; } public CandidConverter? Converter { get; } - public GovernanceApiClient(IAgent agent, Principal canisterId, CandidConverter? converter = default) + public GovernanceApiClient(IAgent agent, Principal canisterId, IIdentity? identity = default, CandidConverter? converter = default) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } public async Task claim_gtc_neurons(Principal arg0, List arg1) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "claim_gtc_neurons", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "claim_gtc_neurons", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task claim_or_refresh_neuron_from_account(ClaimOrRefreshNeuronFromAccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "claim_or_refresh_neuron_from_account", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "claim_or_refresh_neuron_from_account", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task _get_build_metadata() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_build_metadata", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_build_metadata", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task _get_full_neuron(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task _get_full_neuron_by_id_or_subaccount(NeuronIdOrSubaccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron_by_id_or_subaccount", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron_by_id_or_subaccount", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task _get_monthly_node_provider_rewards() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "get_monthly_node_provider_rewards", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "get_monthly_node_provider_rewards", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task _get_network_economics_parameters() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_network_economics_parameters", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_network_economics_parameters", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task> _get_neuron_ids() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_ids", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_ids", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task _get_neuron_info(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task _get_neuron_info_by_id_or_subaccount(NeuronIdOrSubaccount arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info_by_id_or_subaccount", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info_by_id_or_subaccount", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task _get_node_provider_by_caller(NullValue arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_node_provider_by_caller", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_node_provider_by_caller", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task> _get_pending_proposals() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_pending_proposals", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_pending_proposals", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task> _get_proposal_info(ulong arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_proposal_info", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_proposal_info", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } public async Task list_known_neurons() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_known_neurons", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_known_neurons", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task list_neurons(ListNeurons arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_neurons", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_neurons", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task list_node_providers() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_node_providers", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_node_providers", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task list_proposals(ListProposalInfo arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_proposals", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list_proposals", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task manage_neuron(ManageNeuron arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "manage_neuron", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "manage_neuron", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task transfer_gtc_neuron(NeuronId arg0, NeuronId arg1) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter), CandidTypedValue.FromObject(arg1, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "transfer_gtc_neuron", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "transfer_gtc_neuron", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } public async Task update_node_provider(UpdateNodeProvider arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "update_node_provider", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "update_node_provider", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } } From ca7d777c4e0f3c910d637d2a21958b57d363f0fc Mon Sep 17 00:00:00 2001 From: Gekctek Date: Wed, 5 Mar 2025 22:27:36 -0800 Subject: [PATCH 08/20] Fixing clients IIdentity --- samples/Sample.CLI/Program.cs | 4 +- .../ICRC1Ledger/ICRC1LedgerApiClient.cs | 2 +- src/Agent/API.xml | 16 +++- .../AssetCanister/AssetCanisterApiClient.cs | 78 ++++++++++--------- src/Agent/Standards/ICRC1/ICRC1Client.cs | 29 ++++--- 5 files changed, 78 insertions(+), 51 deletions(-) diff --git a/samples/Sample.CLI/Program.cs b/samples/Sample.CLI/Program.cs index ad102af1..9a62770a 100644 --- a/samples/Sample.CLI/Program.cs +++ b/samples/Sample.CLI/Program.cs @@ -160,7 +160,7 @@ public async Task DownloadFileAsync( string outputFilePath ) { - AssetCanisterApiClient client = new(this.agent, canisterId); + AssetCanisterApiClient client = new(this.agent, canisterId, identity: null); Console.WriteLine($"Downloading asset '{key}'..."); (byte[] assetBytes, string contentEncoding) = await client.DownloadAssetAsync(key); @@ -210,7 +210,7 @@ public async Task UploadChunkedFileAsync( string filePath ) { - var client = new AssetCanisterApiClient(this.agent, canisterId); + var client = new AssetCanisterApiClient(this.agent, canisterId, identity: null); Console.WriteLine($"Uploading chunks for asset '{key}'..."); Stream? contentStream = null; diff --git a/samples/Sample.Shared/ICRC1Ledger/ICRC1LedgerApiClient.cs b/samples/Sample.Shared/ICRC1Ledger/ICRC1LedgerApiClient.cs index 137c9253..de8b0993 100644 --- a/samples/Sample.Shared/ICRC1Ledger/ICRC1LedgerApiClient.cs +++ b/samples/Sample.Shared/ICRC1Ledger/ICRC1LedgerApiClient.cs @@ -136,4 +136,4 @@ public async Task Icrc1BalanceOf(Models.Account arg0) return reply.ToObjects(this.Converter); } } -} \ No newline at end of file +} diff --git a/src/Agent/API.xml b/src/Agent/API.xml index 4bf17d49..9b588a5a 100644 --- a/src/Agent/API.xml +++ b/src/Agent/API.xml @@ -1244,6 +1244,11 @@ It is set to just under 2MB. + + + The identity to use for requests. + + The IC agent @@ -1259,12 +1264,13 @@ The optional custom candid converter for request and response objects - + Initializes a new instance of the class. The agent used for communication. The ID of the asset canister. + The identity to use for requests (optional). The Candid converter to use for encoding and decoding values (optional). @@ -2895,6 +2901,11 @@ A pre-generated client for the ICRC1 standard + + + Identity to use for requests + + Agent to use to make requests to the IC @@ -2905,12 +2916,13 @@ The id of the canister to make requests to - + Primary constructor Agent to use to make requests to the IC The id of the canister to make requests to + Optional. The identity to use for requests diff --git a/src/Agent/Standards/AssetCanister/AssetCanisterApiClient.cs b/src/Agent/Standards/AssetCanister/AssetCanisterApiClient.cs index 8445f4bc..01bfd1ff 100644 --- a/src/Agent/Standards/AssetCanister/AssetCanisterApiClient.cs +++ b/src/Agent/Standards/AssetCanister/AssetCanisterApiClient.cs @@ -9,7 +9,7 @@ using EdjCase.ICP.Agent.Standards.AssetCanister.Models; using System.Linq; using System.Threading; -using System.IO.Compression; +using EdjCase.ICP.Agent.Identities; namespace EdjCase.ICP.Agent.Standards.AssetCanister { @@ -28,6 +28,11 @@ public class AssetCanisterApiClient /// public const int MAX_CHUNK_SIZE = MAX_INGRESS_MESSAGE_SIZE - 500; // Just under 2MB + /// + /// The identity to use for requests. + /// + public IIdentity? Identity { get; set; } + /// /// The IC agent /// @@ -48,15 +53,18 @@ public class AssetCanisterApiClient /// /// The agent used for communication. /// The ID of the asset canister. + /// The identity to use for requests (optional). /// The Candid converter to use for encoding and decoding values (optional). public AssetCanisterApiClient( IAgent agent, Principal canisterId, + IIdentity? identity, CandidConverter? converter = default ) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; this.Converter = converter; } @@ -251,7 +259,7 @@ public async Task UploadAssetChunkedAsync( public async Task GetApiVersionAsync() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "api_version", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "api_version", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } @@ -265,7 +273,7 @@ public async Task GetAsync(string key, List acceptEncodings) { GetRequest request = new(key, acceptEncodings); CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(request, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } @@ -290,7 +298,7 @@ public async Task GetChunkAsync( GetChunkRequest request = new(key, contentEncoding, index, sha256Opt); CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(request, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_chunk", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_chunk", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } @@ -301,7 +309,7 @@ public async Task GetChunkAsync( public async Task> ListAsync() { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.EmptyRecord()); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "list", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } @@ -312,7 +320,7 @@ public async Task> ListAsync() public async Task GetCertifiedTreeAsync() { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.EmptyRecord()); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "certified_tree", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "certified_tree", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } @@ -323,7 +331,7 @@ public async Task GetCertifiedTreeAsync() public async Task CreateBatchAsync() { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.EmptyRecord()); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "create_batch", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "create_batch", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } @@ -337,7 +345,7 @@ public async Task CreateChunkAsync(UnboundedUInt batchId, byt { CreateChunkRequest request = new(batchId, content); CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(request, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "create_chunk", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "create_chunk", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } @@ -350,7 +358,7 @@ public async Task CommitBatchAsync(UnboundedUInt batchId, List @@ -362,7 +370,7 @@ public async Task ProposeCommitBatchAsync(UnboundedUInt batchId, List @@ -374,7 +382,7 @@ public async Task CommitProposedBatchAsync(UnboundedUInt batchId, byte[] evidenc { CommitProposedBatchRequest request = new(batchId, evidence); CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(request, this.Converter)); - await this.Agent.CallAsync(this.CanisterId, "commit_proposed_batch", arg); + await this.Agent.CallAsync(this.CanisterId, "commit_proposed_batch", arg, identity: this.Identity); } /// @@ -390,7 +398,7 @@ public async Task> ComputeEvidenceAsync(UnboundedUInt batc : OptionalValue.WithValue(maxIterations.Value); ComputeEvidenceArguments request = new ComputeEvidenceArguments(batchId, maxIterationsOpt); CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(request, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "compute_evidence", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "compute_evidence", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } @@ -402,7 +410,7 @@ public async Task DeleteBatchAsync(UnboundedUInt batchId) { DeleteBatchArguments request = new(batchId); CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(request, this.Converter)); - await this.Agent.CallAsync(this.CanisterId, "delete_batch", arg); + await this.Agent.CallAsync(this.CanisterId, "delete_batch", arg, identity: this.Identity); } /// @@ -448,7 +456,7 @@ public async Task CreateAssetAsync( allowRawAccessOpt ); CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(request, this.Converter)); - await this.Agent.CallAsync(this.CanisterId, "create_asset", arg); + await this.Agent.CallAsync(this.CanisterId, "create_asset", arg, identity: this.Identity); } /// @@ -470,7 +478,7 @@ public async Task SetAssetContentAsync( : OptionalValue.WithValue(sha256); SetAssetContentArguments request = new(key, contentEncoding, chunkIds, sha256Opt); CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(request, this.Converter)); - await this.Agent.CallAsync(this.CanisterId, "set_asset_content", arg); + await this.Agent.CallAsync(this.CanisterId, "set_asset_content", arg, identity: this.Identity); } /// @@ -483,7 +491,7 @@ public async Task UnsetAssetContentAsync(string key, string contentEncoding) { UnsetAssetContentArguments request = new(key, contentEncoding); CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(request, this.Converter)); - await this.Agent.CallAsync(this.CanisterId, "unset_asset_content", arg); + await this.Agent.CallAsync(this.CanisterId, "unset_asset_content", arg, identity: this.Identity); } /// @@ -494,7 +502,7 @@ public async Task DeleteAssetAsync(string key) { DeleteAssetArguments request = new(key); CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(request, this.Converter)); - await this.Agent.CallAsync(this.CanisterId, "delete_asset", arg); + await this.Agent.CallAsync(this.CanisterId, "delete_asset", arg, identity: this.Identity); } /// @@ -503,7 +511,7 @@ public async Task DeleteAssetAsync(string key) public async Task ClearAsync() { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.EmptyRecord()); - await this.Agent.CallAsync(this.CanisterId, "clear", arg); + await this.Agent.CallAsync(this.CanisterId, "clear", arg, identity: this.Identity); } /// @@ -527,7 +535,7 @@ public async Task StoreAsync( : OptionalValue.WithValue(sha256); StoreRequest request = new(key, contentType, contextEncoding, content, sha256Opt); CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(request, this.Converter)); - await this.Agent.CallAsync(this.CanisterId, "store", arg); + await this.Agent.CallAsync(this.CanisterId, "store", arg, identity: this.Identity); } /// @@ -537,7 +545,7 @@ public async Task StoreAsync( public async Task AuthorizeAsync(Principal principal) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(principal, this.Converter)); - await this.Agent.CallAsync(this.CanisterId, "authorize", arg); + await this.Agent.CallAsync(this.CanisterId, "authorize", arg, identity: this.Identity); } /// @@ -547,7 +555,7 @@ public async Task AuthorizeAsync(Principal principal) public async Task DeauthorizeAsync(Principal principal) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(principal, this.Converter)); - await this.Agent.CallAsync(this.CanisterId, "deauthorize", arg); + await this.Agent.CallAsync(this.CanisterId, "deauthorize", arg, identity: this.Identity); } /// @@ -557,7 +565,7 @@ public async Task DeauthorizeAsync(Principal principal) public async Task> ListAuthorizedAsync() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "list_authorized", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "list_authorized", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } @@ -570,7 +578,7 @@ public async Task GrantPermissionAsync(Principal principal, Permission permissio { GrantPermission request = new(principal, permission); CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(request, this.Converter)); - await this.Agent.CallAsync(this.CanisterId, "grant_permission", arg); + await this.Agent.CallAsync(this.CanisterId, "grant_permission", arg, identity: this.Identity); } /// @@ -582,7 +590,7 @@ public async Task RevokePermissionAsync(Principal principal, Permission permissi { RevokePermission request = new RevokePermission(principal, permission); CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(request, this.Converter)); - await this.Agent.CallAsync(this.CanisterId, "revoke_permission", arg); + await this.Agent.CallAsync(this.CanisterId, "revoke_permission", arg, identity: this.Identity); } /// @@ -594,7 +602,7 @@ public async Task> ListPermittedAsync(Permission withPermission) { ListPermitted request = new ListPermitted(withPermission); CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(request, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "list_permitted", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "list_permitted", arg, identity: this.Identity); return reply.ToObjects>(this.Converter); } @@ -604,7 +612,7 @@ public async Task> ListPermittedAsync(Permission withPermission) public async Task TakeOwnershipAsync() { CandidArg arg = CandidArg.FromCandid(); - await this.Agent.CallAsync(this.CanisterId, "take_ownership", arg); + await this.Agent.CallAsync(this.CanisterId, "take_ownership", arg, identity: this.Identity); } /// @@ -615,7 +623,7 @@ public async Task TakeOwnershipAsync() public async Task GetAssetPropertiesAsync(string key) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(key, this.Converter)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_asset_properties", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "get_asset_properties", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } @@ -626,7 +634,7 @@ public async Task GetAssetPropertiesAsync(string key) public async Task SetAssetPropertiesAsync(SetAssetPropertiesRequest request) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(request, this.Converter)); - await this.Agent.CallAsync(this.CanisterId, "set_asset_properties", arg); + await this.Agent.CallAsync(this.CanisterId, "set_asset_properties", arg, identity: this.Identity); } /// @@ -636,7 +644,7 @@ public async Task SetAssetPropertiesAsync(SetAssetPropertiesRequest request) public async Task GetConfigurationAsync() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "get_configuration", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "get_configuration", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } @@ -647,7 +655,7 @@ public async Task GetConfigurationAsync() public async Task ConfigureAsync(ConfigureRequest request) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(request, this.Converter)); - await this.Agent.CallAsync(this.CanisterId, "configure", arg); + await this.Agent.CallAsync(this.CanisterId, "configure", arg, identity: this.Identity); } /// @@ -660,7 +668,7 @@ public async Task ValidateGrantPermissionAsync(Principal princ { GrantPermission request = new(principal, permission); CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(request, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "validate_grant_permission", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "validate_grant_permission", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } @@ -674,7 +682,7 @@ public async Task ValidateRevokePermissionAsync(Principal prin { RevokePermission request = new(principal, permission); CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(request, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "validate_revoke_permission", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "validate_revoke_permission", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } @@ -685,7 +693,7 @@ public async Task ValidateRevokePermissionAsync(Principal prin public async Task ValidateTakeOwnershipAsync() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "validate_take_ownership", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "validate_take_ownership", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } @@ -697,7 +705,7 @@ public async Task ValidateTakeOwnershipAsync() public async Task ValidateCommitProposedBatchAsync(CommitProposedBatchRequest request) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(request, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "validate_commit_proposed_batch", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "validate_commit_proposed_batch", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } @@ -709,7 +717,7 @@ public async Task ValidateCommitProposedBatchAsync(CommitPropo public async Task ValidateConfigureAsync(ConfigureRequest request) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(request, this.Converter)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "validate_configure", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "validate_configure", arg, identity: this.Identity); return reply.ToObjects(this.Converter); } } diff --git a/src/Agent/Standards/ICRC1/ICRC1Client.cs b/src/Agent/Standards/ICRC1/ICRC1Client.cs index 4ad8b720..26cf6cc8 100644 --- a/src/Agent/Standards/ICRC1/ICRC1Client.cs +++ b/src/Agent/Standards/ICRC1/ICRC1Client.cs @@ -1,4 +1,5 @@ using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Agent.Standards.ICRC1.Models; using EdjCase.ICP.Candid.Models; using System.Collections.Generic; @@ -11,6 +12,10 @@ namespace EdjCase.ICP.Agent.Standards.ICRC1 /// public class ICRC1Client { + /// + /// Identity to use for requests + /// + public IIdentity? Identity { get; set; } /// /// Agent to use to make requests to the IC /// @@ -26,10 +31,12 @@ public class ICRC1Client /// /// Agent to use to make requests to the IC /// The id of the canister to make requests to - public ICRC1Client(IAgent agent, Principal canisterId) + /// Optional. The identity to use for requests + public ICRC1Client(IAgent agent, Principal canisterId, IIdentity? identity) { this.Agent = agent; this.CanisterId = canisterId; + this.Identity = identity; } /// @@ -39,7 +46,7 @@ public ICRC1Client(IAgent agent, Principal canisterId) public async Task> MetaData() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "icrc1_meta_data", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "icrc1_meta_data", arg, identity: this.Identity); return reply.ToObjects>(); } @@ -50,7 +57,7 @@ public async Task> MetaData() public async Task Name() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "icrc1_name", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "icrc1_name", arg, identity: this.Identity); return reply.ToObjects(); } @@ -61,7 +68,7 @@ public async Task Name() public async Task Symbol() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "icrc1_symbol", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "icrc1_symbol", arg, identity: this.Identity); return reply.ToObjects(); } @@ -72,7 +79,7 @@ public async Task Symbol() public async Task Decimals() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "icrc1_decimals", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "icrc1_decimals", arg, identity: this.Identity); return reply.ToObjects(); } @@ -83,7 +90,7 @@ public async Task Decimals() public async Task Fee() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "icrc1_fee", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "icrc1_fee", arg, identity: this.Identity); return reply.ToObjects(); } @@ -94,7 +101,7 @@ public async Task Fee() public async Task TotalSupply() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "icrc1_total_supply", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "icrc1_total_supply", arg, identity: this.Identity); return reply.ToObjects(); } @@ -105,7 +112,7 @@ public async Task TotalSupply() public async Task> MintingAccount() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "icrc1_minting_account", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "icrc1_minting_account", arg, identity: this.Identity); return reply.ToObjects>(); } @@ -117,7 +124,7 @@ public async Task> MintingAccount() public async Task BalanceOf(Account account) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(account)); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "icrc1_balance_of", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "icrc1_balance_of", arg, identity: this.Identity); return reply.ToObjects(); } @@ -129,7 +136,7 @@ public async Task BalanceOf(Account account) public async Task Transfer(TransferArgs args) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(args)); - CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "icrc1_transfer", arg); + CandidArg reply = await this.Agent.CallAsync(this.CanisterId, "icrc1_transfer", arg, identity: this.Identity); return reply.ToObjects(); } @@ -140,7 +147,7 @@ public async Task Transfer(TransferArgs args) public async Task> SupportedStandards() { CandidArg arg = CandidArg.FromCandid(); - CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "icrc1_supported_standards", arg); + CandidArg reply = await this.Agent.QueryAsync(this.CanisterId, "icrc1_supported_standards", arg, identity: this.Identity); return reply.ToObjects>(); } } From be4e191512a400eb4b8bdad33b2927d3f9fb76c0 Mon Sep 17 00:00:00 2001 From: Gekctek Date: Thu, 6 Mar 2025 10:38:39 -0800 Subject: [PATCH 09/20] Adding missing comment docs --- src/Agent/API.xml | 117 ++++++++++++++++++++++-------- src/Agent/Agents/IAgent.cs | 66 +++++++++++++++-- src/Agent/Models/Certificate.cs | 5 +- src/Agent/Models/SignedContent.cs | 9 ++- 4 files changed, 154 insertions(+), 43 deletions(-) diff --git a/src/Agent/API.xml b/src/Agent/API.xml index 9b588a5a..135172c4 100644 --- a/src/Agent/API.xml +++ b/src/Agent/API.xml @@ -4,35 +4,6 @@ EdjCase.ICP.Agent - - - An `IAgent` implementation using HTTP to make requests to the IC - - - - Optional. Sets the http client to use, otherwise will use the default http client - - - Url to the boundry node to connect to. Defaults to `https://ic0.app/` - - - - - - - - - - - - - - - - - - - The default http client to use with the built in `HttpClient` @@ -101,12 +72,77 @@ + + + An `IAgent` implementation using HTTP to make requests to the IC + + + + Optional. Sets the http client to use, otherwise will use the default http client + + + Url to the boundry node to connect to. Defaults to `https://ic0.app/` + + + + + + + + + + + + + + + + + + + An agent is used to communicate with the Internet Computer with certain protocols that are specific to an `IAgent` implementation + + + Sends a call request to a canister with already signed content + + The signed content containing the call request + Optional. Specifies the relevant canister id if calling the root canister + Optional. Token to cancel request + The candid arg response to the call + + + + Sends an asynchronous call request to a canister with already signed content + + The signed content containing the call request + Optional. Specifies the relevant canister id if calling the root canister + Optional. Token to cancel request + The id of the request that can be used to look up its status with `GetRequestStatusAsync` + + + + Sends a query request to a canister with already signed content + + The signed content containing the query request + Optional. Specifies the relevant canister id if calling the root canister + Optional. Token to cancel request + The response data of the query call + + + + Reads the state of a specified canister with already signed content + + Canister to read state for + The signed content containing the read state request + Optional. Token to cancel request + A response that contains the certificate of the current canister state + Gets the status of the IC replica. This includes versioning information @@ -199,6 +235,18 @@ Optional. Token to cancel request The raw candid arg response + + + Sends a call request with already signed content to a specified canister method, waits for the request to be processed, + then returns the candid response to the call. This is a helper method built on top of `CallAsynchronousAsync` + to wait for the response so it doesn't need to be implemented manually + + The agent to use for the call + The signed content containing the call request + Optional. Specifies the relevant canister id if calling the root canister + Optional. Token to cancel request + The raw candid arg response + Gets the status of a request that is being processed by the specified canister @@ -609,10 +657,9 @@ - Checks the validity of the certificate based off the + Checks the validity of the certificate based off the specified root public key - BLS crytography implementation to verify signature The root public key (DER encoded) of the internet computer network True if the certificate is valid, otherwise false @@ -756,13 +803,19 @@ The hash of the content used for request identification The content that is signed in the form of key value pairs Public key used to authenticate this request, unless anonymous, then null - Optional. A chain of delegations, starting with the one signed by sender_pubkey + Optional. A chain of delegations, starting with the one signed by sender_pubkey and ending with the one delegating to the key relating to sender_sig. Signature to authenticate this request, unless anonymous, then null + + + Serializes this signed content object to CBOR (Concise Binary Object Representation) format. + + A byte array containing the CBOR-encoded representation of this object. + A delegation that has been signed by an identity diff --git a/src/Agent/Agents/IAgent.cs b/src/Agent/Agents/IAgent.cs index 9b6a61ca..bdc1a834 100644 --- a/src/Agent/Agents/IAgent.cs +++ b/src/Agent/Agents/IAgent.cs @@ -20,10 +20,57 @@ namespace EdjCase.ICP.Agent.Agents /// public interface IAgent { - Task CallAsync(SignedContent content, Principal? effectiveCanisterId = null, CancellationToken? cancellationToken = null); - Task CallAsynchronousAsync(SignedContent content, Principal? effectiveCanisterId = null, CancellationToken? cancellationToken = null); - Task QueryAsync(SignedContent content, Principal? effectiveCanisterId = null, CancellationToken? cancellationToken = null); - Task ReadStateAsync(Principal canisterId, SignedContent content, CancellationToken? cancellationToken = null); + /// + /// Sends a call request to a canister with already signed content + /// + /// The signed content containing the call request + /// Optional. Specifies the relevant canister id if calling the root canister + /// Optional. Token to cancel request + /// The candid arg response to the call + Task CallAsync( + SignedContent content, + Principal? effectiveCanisterId = null, + CancellationToken? cancellationToken = null + ); + + /// + /// Sends an asynchronous call request to a canister with already signed content + /// + /// The signed content containing the call request + /// Optional. Specifies the relevant canister id if calling the root canister + /// Optional. Token to cancel request + /// The id of the request that can be used to look up its status with `GetRequestStatusAsync` + Task CallAsynchronousAsync( + SignedContent content, + Principal? effectiveCanisterId = null, + CancellationToken? cancellationToken = null + ); + + /// + /// Sends a query request to a canister with already signed content + /// + /// The signed content containing the query request + /// Optional. Specifies the relevant canister id if calling the root canister + /// Optional. Token to cancel request + /// The response data of the query call + Task QueryAsync( + SignedContent content, + Principal? effectiveCanisterId = null, + CancellationToken? cancellationToken = null + ); + + /// + /// Reads the state of a specified canister with already signed content + /// + /// Canister to read state for + /// The signed content containing the read state request + /// Optional. Token to cancel request + /// A response that contains the certificate of the current canister state + Task ReadStateAsync( + Principal canisterId, + SignedContent content, + CancellationToken? cancellationToken = null + ); /// /// Gets the status of the IC replica. This includes versioning information @@ -200,7 +247,16 @@ public static async Task CallAsynchronousAndWaitAsync( return await agent.WaitForRequestAsync(canisterId, id, cancellationToken); } - + /// + /// Sends a call request with already signed content to a specified canister method, waits for the request to be processed, + /// then returns the candid response to the call. This is a helper method built on top of `CallAsynchronousAsync` + /// to wait for the response so it doesn't need to be implemented manually + /// + /// The agent to use for the call + /// The signed content containing the call request + /// Optional. Specifies the relevant canister id if calling the root canister + /// Optional. Token to cancel request + /// The raw candid arg response public static async Task CallAsynchronousAndWaitAsync( this IAgent agent, SignedContent content, diff --git a/src/Agent/Models/Certificate.cs b/src/Agent/Models/Certificate.cs index c1bed509..d534442c 100644 --- a/src/Agent/Models/Certificate.cs +++ b/src/Agent/Models/Certificate.cs @@ -41,13 +41,12 @@ public Certificate(HashTree tree, byte[] signature, CertificateDelegation? deleg } /// - /// Checks the validity of the certificate based off the + /// Checks the validity of the certificate based off the /// specified root public key /// - /// BLS crytography implementation to verify signature /// The root public key (DER encoded) of the internet computer network /// True if the certificate is valid, otherwise false - public bool IsValid( SubjectPublicKeyInfo rootPublicKey) + public bool IsValid(SubjectPublicKeyInfo rootPublicKey) { /* verify_cert(cert) = diff --git a/src/Agent/Models/SignedContent.cs b/src/Agent/Models/SignedContent.cs index 17b84a56..588ba6e4 100644 --- a/src/Agent/Models/SignedContent.cs +++ b/src/Agent/Models/SignedContent.cs @@ -41,7 +41,7 @@ public class SignedContent : IRepresentationIndependentHashItem /// The hash of the content used for request identification /// The content that is signed in the form of key value pairs /// Public key used to authenticate this request, unless anonymous, then null - /// Optional. A chain of delegations, starting with the one signed by sender_pubkey + /// Optional. A chain of delegations, starting with the one signed by sender_pubkey /// and ending with the one delegating to the key relating to sender_sig. /// Signature to authenticate this request, unless anonymous, then null public SignedContent( @@ -81,10 +81,13 @@ public Dictionary BuildHashableItem() return properties; } - + /// + /// Serializes this signed content object to CBOR (Concise Binary Object Representation) format. + /// + /// A byte array containing the CBOR-encoded representation of this object. public byte[] ToCborBytes() { - CborWriter writer = new (); + CborWriter writer = new(); writer.WriteTag(CborTag.SelfDescribeCbor); this.WriteCbor(writer); return writer.Encode(); From de78400903b2cb11f3867476e63e55c2eb2b436c Mon Sep 17 00:00:00 2001 From: Gekctek Date: Thu, 6 Mar 2025 10:56:26 -0800 Subject: [PATCH 10/20] SkipCertificateValidation --- src/Agent/API.xml | 6 ++- src/Agent/Agents/HttpAgent.cs | 27 +++++++++---- src/BLS/DefaultBlsCryptograhy.cs | 7 ---- src/WebSockets/WebSocketAgent.cs | 14 +++++-- test/PocketIC.Tests/PocketIcServerFixture.cs | 2 - test/WebSockets.Tests/WebSocketsAgentTests.cs | 38 ++++++++++--------- 6 files changed, 54 insertions(+), 40 deletions(-) diff --git a/src/Agent/API.xml b/src/Agent/API.xml index 135172c4..019c7192 100644 --- a/src/Agent/API.xml +++ b/src/Agent/API.xml @@ -77,11 +77,13 @@ An `IAgent` implementation using HTTP to make requests to the IC - + Optional. Sets the http client to use, otherwise will use the default http client + If true, will skip response certificate validation. Defaults to false - + Url to the boundry node to connect to. Defaults to `https://ic0.app/` + If true, will skip response certificate validation. Defaults to false diff --git a/src/Agent/Agents/HttpAgent.cs b/src/Agent/Agents/HttpAgent.cs index b36cff9c..ca1bfc5e 100644 --- a/src/Agent/Agents/HttpAgent.cs +++ b/src/Agent/Agents/HttpAgent.cs @@ -26,21 +26,26 @@ public class HttpAgent : IAgent private byte[]? rootKeyCache = null; private readonly IHttpClient httpClient; + private bool skipCertificateValidation = false; private bool v3CallSupported = true; /// Optional. Sets the http client to use, otherwise will use the default http client - public HttpAgent(IHttpClient httpClient) + /// If true, will skip response certificate validation. Defaults to false + public HttpAgent(IHttpClient httpClient, bool skipCertificateValidation = false) { this.httpClient = httpClient ?? throw new ArgumentNullException(nameof(httpClient)); + this.skipCertificateValidation = skipCertificateValidation; } /// Url to the boundry node to connect to. Defaults to `https://ic0.app/` - public HttpAgent(Uri? httpBoundryNodeUrl = null) + /// If true, will skip response certificate validation. Defaults to false + public HttpAgent(Uri? httpBoundryNodeUrl = null, bool skipCertificateValidation = false) { this.httpClient = new DefaultHttpClient(new HttpClient() { BaseAddress = httpBoundryNodeUrl ?? new Uri("https://ic0.app/") }); + this.skipCertificateValidation = skipCertificateValidation; } @@ -77,10 +82,13 @@ public async Task CallAsync( var reader = new CborReader(cborBytes); V3CallResponse v3CallResponse = V3CallResponse.ReadCbor(reader); - SubjectPublicKeyInfo rootPublicKey = await this.GetRootKeyAsync(cancellationToken); - if (!v3CallResponse.Certificate.IsValid(rootPublicKey)) + if (!this.skipCertificateValidation) { - throw new InvalidCertificateException("Certificate signature does not match the IC public key"); + SubjectPublicKeyInfo rootPublicKey = await this.GetRootKeyAsync(cancellationToken); + if (!v3CallResponse.Certificate.IsValid(rootPublicKey)) + { + throw new InvalidCertificateException("Certificate signature does not match the IC public key"); + } } HashTree? requestStatusData = v3CallResponse.Certificate.Tree.GetValueOrDefault(StatePath.FromSegments("request_status", content.RequestId.RawValue)); RequestStatus? requestStatus = IAgentExtensions.ParseRequestStatus(requestStatusData); @@ -166,10 +174,13 @@ public async Task ReadStateAsync( var reader = new CborReader(cborBytes); ReadStateResponse response = ReadStateResponse.ReadCbor(reader); - SubjectPublicKeyInfo rootPublicKey = await this.GetRootKeyAsync(cancellationToken); - if (!response.Certificate.IsValid(rootPublicKey)) + if (!this.skipCertificateValidation) { - throw new InvalidCertificateException("Certificate signature does not match the IC public key"); + SubjectPublicKeyInfo rootPublicKey = await this.GetRootKeyAsync(cancellationToken); + if (!response.Certificate.IsValid(rootPublicKey)) + { + throw new InvalidCertificateException("Certificate signature does not match the IC public key"); + } } return response; diff --git a/src/BLS/DefaultBlsCryptograhy.cs b/src/BLS/DefaultBlsCryptograhy.cs index c6f092d1..6270f432 100644 --- a/src/BLS/DefaultBlsCryptograhy.cs +++ b/src/BLS/DefaultBlsCryptograhy.cs @@ -14,7 +14,6 @@ namespace EdjCase.ICP.BLS /// internal static class DefaultBlsCryptograhy { - public static bool Bypass = false; // TODO this isn't safe for multi-threaded use like with tests internal static readonly byte[] DomainSeperator; @@ -26,12 +25,6 @@ static DefaultBlsCryptograhy() /// public static bool VerifySignature(byte[] publicKey, byte[] messageHash, byte[] signature) { - if (DefaultBlsCryptograhy.Bypass) - { - // Always return true if bypass is enabled - // Used for testing and debugging - return true; - } G1Affine sig = G1Affine.FromCompressed(signature); G2Prepared g2Gen = G2Affine.Generator().Neg().ToProjective().ToPrepared(); diff --git a/src/WebSockets/WebSocketAgent.cs b/src/WebSockets/WebSocketAgent.cs index 4af4be8c..c37b526f 100644 --- a/src/WebSockets/WebSocketAgent.cs +++ b/src/WebSockets/WebSocketAgent.cs @@ -40,6 +40,7 @@ internal class WebSocketAgent : IWebSocketAgent private ulong outgoingSequenceNumber = 1; private ulong incomingSequenceNumber = 1; private SHA256HashFunction sha256 = SHA256HashFunction.Create(); + private bool skipCertificateValidation { get; } public bool IsOpen => this.client.IsOpen; @@ -53,7 +54,8 @@ public WebSocketAgent( Action? onOpen = null, Action? onError = null, Action? onClose = null, - CandidConverter? customConverter = null + CandidConverter? customConverter = null, + bool skipCertificateValidation = false ) { this.canisterId = canisterId ?? throw new ArgumentNullException(nameof(canisterId)); @@ -66,6 +68,7 @@ public WebSocketAgent( this.onError = onError; this.onClose = onClose; this.customConverter = customConverter; + this.skipCertificateValidation = skipCertificateValidation; } public async Task ConnectAsync( @@ -284,10 +287,13 @@ private bool ValidateMessage( } - if (cert == null || !cert.IsValid(this.RootPublicKey)) + if (!this.skipCertificateValidation) { - error = "Message certificate is invalid: Invalid signature"; - return false; + if (cert == null || !cert.IsValid(this.RootPublicKey)) + { + error = "Message certificate is invalid: Invalid signature"; + return false; + } } HashTree? witness = cert!.Tree.GetValueOrDefault( "canister", diff --git a/test/PocketIC.Tests/PocketIcServerFixture.cs b/test/PocketIC.Tests/PocketIcServerFixture.cs index 93763c0c..a8a40bbf 100644 --- a/test/PocketIC.Tests/PocketIcServerFixture.cs +++ b/test/PocketIC.Tests/PocketIcServerFixture.cs @@ -13,12 +13,10 @@ public PocketIcServerFixture() { // Start the server for all tests this.Server = PocketIcServer.StartAsync(runtimeLogLevel: LogLevel.Debug, showErrorLogs: true).GetAwaiter().GetResult(); - DefaultBlsCryptograhy.Bypass = true; } public void Dispose() { - DefaultBlsCryptograhy.Bypass = false; // Stop the server after all tests if (this.Server != null) { diff --git a/test/WebSockets.Tests/WebSocketsAgentTests.cs b/test/WebSockets.Tests/WebSocketsAgentTests.cs index 2d1c54f8..891c27e3 100644 --- a/test/WebSockets.Tests/WebSocketsAgentTests.cs +++ b/test/WebSockets.Tests/WebSocketsAgentTests.cs @@ -29,7 +29,6 @@ private class TestMessage [Fact] public async Task ValidCallAndClose() { - DefaultBlsCryptograhy.Bypass = true; int onMessageCallCount = 0; int onOpenCallCount = 0; int onErrorCallCount = 0; @@ -52,12 +51,14 @@ public async Task ValidCallAndClose() .Returns(Task.CompletedTask); clientMock .SetupSequence(client => client.ReceiveAsync(It.IsAny())) - .ReturnsAsync(() => { + .ReturnsAsync(() => + { // Handshake: 55799({"gateway_principal": h'...'}) byte[] handshakeBytes = ByteUtil.FromHexString("D9D9F7A171676174657761795F7072696E636970616C581D505A46A6746E7D266C3301A70CDA43E072476D1736EACAFD7327BEF802"); return (handshakeBytes, false); }) - .ReturnsAsync(() => { + .ReturnsAsync(() => + { // Open ClientKey clientKey = new() { @@ -79,7 +80,8 @@ public async Task ValidCallAndClose() ); return (openMessageBytes, false); }) - .ReturnsAsync(() => { + .ReturnsAsync(() => + { // Message ClientKey clientKey = new() { @@ -99,7 +101,8 @@ public async Task ValidCallAndClose() ); return (appMessageBytes, false); }) - .ReturnsAsync(() => { + .ReturnsAsync(() => + { // Ack ClientKey clientKey = new() { @@ -121,7 +124,8 @@ public async Task ValidCallAndClose() ); return (openMessageBytes, false); }) - .ReturnsAsync(() => { + .ReturnsAsync(() => + { // Close ClientKey clientKey = new() { @@ -148,7 +152,8 @@ public async Task ValidCallAndClose() onMessageCallCount += 1; }; Action onOpen = () => { onOpenCallCount += 1; }; - Action onError = (Exception exception) => { + Action onError = (Exception exception) => + { Assert.Fail(exception.ToString()); }; Action onClose = () => { onCloseCallCount += 1; }; @@ -163,7 +168,8 @@ public async Task ValidCallAndClose() onOpen, onError, onClose, - customConverter: null + customConverter: null, + skipCertificateValidation: true ); clientNonce = agent.ClientNonce; while (agent.IsOpen) @@ -175,13 +181,11 @@ public async Task ValidCallAndClose() Assert.Equal(1, onMessageCallCount); Assert.Equal(0, onErrorCallCount); Assert.Equal(1, onCloseCallCount); - DefaultBlsCryptograhy.Bypass = false; } [Fact] public async Task InvalidAck_Close() { - DefaultBlsCryptograhy.Bypass = true; int onMessageCallCount = 0; int onOpenCallCount = 0; int onErrorCallCount = 0; @@ -287,7 +291,8 @@ public async Task InvalidAck_Close() onMessageCallCount += 1; }; Action onOpen = () => { onOpenCallCount += 1; }; - Action onError = (Exception exception) => { + Action onError = (Exception exception) => + { Assert.Contains("Ack sequence is invalid", exception.ToString()); onErrorCallCount += 1; }; @@ -303,7 +308,8 @@ public async Task InvalidAck_Close() onOpen, onError, onClose, - customConverter: null + customConverter: null, + skipCertificateValidation: true ); clientNonce = agent.ClientNonce; while (agent.IsOpen) @@ -315,8 +321,6 @@ public async Task InvalidAck_Close() Assert.Equal(1, onMessageCallCount); Assert.Equal(1, onErrorCallCount); Assert.Equal(0, onCloseCallCount); - - DefaultBlsCryptograhy.Bypass = false; } @@ -369,19 +373,19 @@ bool isServiceMessage cert.ToCbor(cborWriter); byte[] certBytes = cborWriter.Encode(); - cborWriter = new (); + cborWriter = new(); cborWriter.WriteTag(CborTag.SelfDescribeCbor); Certificate.TreeToCborInternal(cborWriter, tree); byte[] treeBytes = cborWriter.Encode(); - ClientIncomingMessage incomingMessage = new ( + ClientIncomingMessage incomingMessage = new( key: clientKeyString, content: content, cert: certBytes, tree: treeBytes ); - cborWriter = new (); + cborWriter = new(); incomingMessage.ToCbor(cborWriter); return cborWriter.Encode(); } From ca6b366b74cd501da0c95c9aff7b0be8953bb1f0 Mon Sep 17 00:00:00 2001 From: Gekctek Date: Thu, 6 Mar 2025 11:03:07 -0800 Subject: [PATCH 11/20] Updating default url to icp-api.io vs ic0.app --- UnityAssets/UnityHttp.cs | 2 +- samples/Sample.CLI/README.md | 4 +- src/Agent/API.xml | 62 +++++++++---------- src/Agent/Agents/HttpAgent.cs | 2 +- src/ClientGenerator/API.xml | 4 +- .../ClientGenerationOptions.cs | 4 +- src/ClientGenerator/README.md | 2 +- 7 files changed, 40 insertions(+), 40 deletions(-) diff --git a/UnityAssets/UnityHttp.cs b/UnityAssets/UnityHttp.cs index 3e03c512..13dfbe16 100644 --- a/UnityAssets/UnityHttp.cs +++ b/UnityAssets/UnityHttp.cs @@ -39,7 +39,7 @@ private static Uri GetUri(string path) { path = "/" + path; } - return new Uri("https://ic0.app" + path); + return new Uri("https://icp-api.io" + path); } private static HttpResponse ParseResponse(UnityWebRequest request) diff --git a/samples/Sample.CLI/README.md b/samples/Sample.CLI/README.md index 796178bf..5e3ebd29 100644 --- a/samples/Sample.CLI/README.md +++ b/samples/Sample.CLI/README.md @@ -18,7 +18,7 @@ Required: - file_path - The path of the file to upload Optional: -- ic_url - Defaults to ic0.app. Use if wanting to use local (e.g http://127.0.0.1:4943) +- ic_url - Defaults to icp-api.io. Use if wanting to use local (e.g http://127.0.0.1:4943) - pem_file_path - Use to set identity of upload request. Defaults to anonymous identity - pem_password - Use if the pem_file_path is set and it is encrypted ``` @@ -36,7 +36,7 @@ Required: - output_file_path - The path of the file to download to Optional: -- ic_url - Defaults to ic0.app. Use if wanting to use local (e.g http://127.0.0.1:4943) +- ic_url - Defaults to icp-api.io. Use if wanting to use local (e.g http://127.0.0.1:4943) - pem_file_path - Use to set identity of upload request. Defaults to anonymous identity - pem_password - Use if the pem_file_path is set and it is encrypted ``` diff --git a/src/Agent/API.xml b/src/Agent/API.xml index 019c7192..65a00368 100644 --- a/src/Agent/API.xml +++ b/src/Agent/API.xml @@ -4,6 +4,37 @@ EdjCase.ICP.Agent + + + An `IAgent` implementation using HTTP to make requests to the IC + + + + Optional. Sets the http client to use, otherwise will use the default http client + If true, will skip response certificate validation. Defaults to false + + + Url to the boundry node to connect to. Defaults to `https://ic0.app/` + If true, will skip response certificate validation. Defaults to false + + + + + + + + + + + + + + + + + + + The default http client to use with the built in `HttpClient` @@ -72,37 +103,6 @@ - - - An `IAgent` implementation using HTTP to make requests to the IC - - - - Optional. Sets the http client to use, otherwise will use the default http client - If true, will skip response certificate validation. Defaults to false - - - Url to the boundry node to connect to. Defaults to `https://ic0.app/` - If true, will skip response certificate validation. Defaults to false - - - - - - - - - - - - - - - - - - - An agent is used to communicate with the Internet Computer with certain protocols that diff --git a/src/Agent/Agents/HttpAgent.cs b/src/Agent/Agents/HttpAgent.cs index ca1bfc5e..ee8b4e44 100644 --- a/src/Agent/Agents/HttpAgent.cs +++ b/src/Agent/Agents/HttpAgent.cs @@ -43,7 +43,7 @@ public HttpAgent(Uri? httpBoundryNodeUrl = null, bool skipCertificateValidation { this.httpClient = new DefaultHttpClient(new HttpClient() { - BaseAddress = httpBoundryNodeUrl ?? new Uri("https://ic0.app/") + BaseAddress = httpBoundryNodeUrl ?? new Uri("https://icp-api.io/") }); this.skipCertificateValidation = skipCertificateValidation; } diff --git a/src/ClientGenerator/API.xml b/src/ClientGenerator/API.xml index 387f9955..d10a5806 100644 --- a/src/ClientGenerator/API.xml +++ b/src/ClientGenerator/API.xml @@ -97,7 +97,7 @@ - Optional. The url of the boundry node for the internet computer. Defaults to ic0.app + Optional. The url of the boundry node for the internet computer. Defaults to icp-api.io @@ -118,7 +118,7 @@ If true, variant classes will be generated with properties instead of methods If true, the names of properties and methods will keep the raw candid name. Otherwise they will be converted to something prettier If false, OptionalValue will be used for opt values, Otherwise will use just the nullable class values or nullable struct where possible. Defaults to false - Optional. The url of the boundry node for the internet computer. Defaults to ic0.app + Optional. The url of the boundry node for the internet computer. Defaults to icp-api.io Optional. Specifies options for each candid type in the definition diff --git a/src/ClientGenerator/ClientGenerationOptions.cs b/src/ClientGenerator/ClientGenerationOptions.cs index 6666f5e5..c50821dd 100644 --- a/src/ClientGenerator/ClientGenerationOptions.cs +++ b/src/ClientGenerator/ClientGenerationOptions.cs @@ -75,7 +75,7 @@ public class ClientGenerationOptions public bool OverrideOptionalValue { get; } /// - /// Optional. The url of the boundry node for the internet computer. Defaults to ic0.app + /// Optional. The url of the boundry node for the internet computer. Defaults to icp-api.io /// public Uri? BoundryNodeUrl { get; } @@ -97,7 +97,7 @@ public class ClientGenerationOptions /// If true, variant classes will be generated with properties instead of methods /// If true, the names of properties and methods will keep the raw candid name. Otherwise they will be converted to something prettier /// If false, OptionalValue will be used for opt values, Otherwise will use just the nullable class values or nullable struct where possible. Defaults to false - /// Optional. The url of the boundry node for the internet computer. Defaults to ic0.app + /// Optional. The url of the boundry node for the internet computer. Defaults to icp-api.io /// Optional. Specifies options for each candid type in the definition public ClientGenerationOptions( string name, diff --git a/src/ClientGenerator/README.md b/src/ClientGenerator/README.md index 317c1047..93e5dfba 100644 --- a/src/ClientGenerator/README.md +++ b/src/ClientGenerator/README.md @@ -59,7 +59,7 @@ candid-client-generator gen ./ Files generated in a sub-folder will have a more specific namespace to match. This namespace can be overidden per client. - `output-directory` - (Text) OPTIONAL. Directory to put all generated files. Each client will have a sub-folder within the output directory that will match the client name. If not specified, the working directory will be used - `no-folders` - (Bool) OPTIONAL. If true, no sub-folders will be generated for the clients or the models within the clients. All generated files will be in a flat structure. Defaults to false -- `url` - (Text) OPTIONAL. Sets the boundry node url to use for making calls to canisters on the IC. Can be set to a local developer instance/localhost. Defaults to 'https://ic0.app/'. This setting is only useful for clients of generation type `canister` +- `url` - (Text) OPTIONAL. Sets the boundry node url to use for making calls to canisters on the IC. Can be set to a local developer instance/localhost. Defaults to 'https://icp-api.io/'. This setting is only useful for clients of generation type `canister` - `feature-nullable` - (Bool) Optional. Sets whether to use the C# nullable feature when generating the client (like `object?`). Defaults to true - `variants-use-properties` - (Bool) Optional. If true, the generated variant classes will use properties instead of methods for data access. Defaults to false - `keep-candid-case` - (Bool) Optional. If true, the names of properties and methods will keep the raw candid name. Otherwise they will be converted to something prettier. Defaults to false From e87b6cc043b5f6959103013c5744da5cc28d555b Mon Sep 17 00:00:00 2001 From: Gekctek Date: Thu, 6 Mar 2025 11:06:28 -0800 Subject: [PATCH 12/20] More icp-api.io --- samples/Sample.CLI/Program.cs | 4 ++-- src/Agent/API.xml | 2 +- src/Agent/Agents/HttpAgent.cs | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/samples/Sample.CLI/Program.cs b/samples/Sample.CLI/Program.cs index 9a62770a..54f990b7 100644 --- a/samples/Sample.CLI/Program.cs +++ b/samples/Sample.CLI/Program.cs @@ -27,7 +27,7 @@ public class Program [Verb("upload-asset", HelpText = "Upload a file to an asset canister.")] class UploadOptions { - [Option('u', "url", Required = false, HelpText = "The url to the boundy node", Default = "https://ic0.app")] + [Option('u', "url", Required = false, HelpText = "The url to the boundy node", Default = "https://icp-api.io")] public string? Url { get; set; } [Option('c', "canister-id", Required = true, HelpText = "The asset canister id to upload to")] @@ -55,7 +55,7 @@ class UploadOptions [Verb("download-asset", HelpText = "Download a file from an asset canister.")] class DownloadOptions { - [Option('u', "url", Required = false, HelpText = "The url to the boundy node", Default = "https://ic0.app")] + [Option('u', "url", Required = false, HelpText = "The url to the boundy node", Default = "https://icp-api.io")] public string? Url { get; set; } [Option('c', "canister-id", Required = true, HelpText = "The asset canister id to download from")] diff --git a/src/Agent/API.xml b/src/Agent/API.xml index 65a00368..1020c52c 100644 --- a/src/Agent/API.xml +++ b/src/Agent/API.xml @@ -14,7 +14,7 @@ If true, will skip response certificate validation. Defaults to false - Url to the boundry node to connect to. Defaults to `https://ic0.app/` + Url to the boundry node to connect to. Defaults to `https://icp-api.io/` If true, will skip response certificate validation. Defaults to false diff --git a/src/Agent/Agents/HttpAgent.cs b/src/Agent/Agents/HttpAgent.cs index ee8b4e44..c4b762c5 100644 --- a/src/Agent/Agents/HttpAgent.cs +++ b/src/Agent/Agents/HttpAgent.cs @@ -37,7 +37,7 @@ public HttpAgent(IHttpClient httpClient, bool skipCertificateValidation = false) this.skipCertificateValidation = skipCertificateValidation; } - /// Url to the boundry node to connect to. Defaults to `https://ic0.app/` + /// Url to the boundry node to connect to. Defaults to `https://icp-api.io/` /// If true, will skip response certificate validation. Defaults to false public HttpAgent(Uri? httpBoundryNodeUrl = null, bool skipCertificateValidation = false) { From 1168a4367e92268d06eba0fd9b567fc69b0470b3 Mon Sep 17 00:00:00 2001 From: Gekctek Date: Thu, 6 Mar 2025 14:56:48 -0800 Subject: [PATCH 13/20] Adding replica controller sample --- .../Controllers/ReplicaController.cs | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 samples/Sample.RestAPI/Controllers/ReplicaController.cs diff --git a/samples/Sample.RestAPI/Controllers/ReplicaController.cs b/samples/Sample.RestAPI/Controllers/ReplicaController.cs new file mode 100644 index 00000000..05271064 --- /dev/null +++ b/samples/Sample.RestAPI/Controllers/ReplicaController.cs @@ -0,0 +1,42 @@ +using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Responses; +using EdjCase.ICP.Candid.Models; +using Microsoft.AspNetCore.Mvc; +using Sample.Shared.Governance; +using Sample.Shared.Governance.Models; +using System.Threading; + +namespace Sample.RestAPI.Controllers +{ + [ApiController] + [Route("api/[controller]")] + public class ReplicaController : ControllerBase + { + public IAgent Agent { get; } + public HttpClient HttpClient { get; } + public ReplicaController(IAgent agent) + { + this.Agent = agent; + this.HttpClient = new HttpClient + { + BaseAddress = new Uri("https://icp-api.io/") + }; + } + + [Route("status")] + [HttpGet] + public async Task GetRewards() + { + StatusResponse status = await this.Agent.GetReplicaStatusAsync(); + return this.Ok(status); + } + + [Route("api_boundary_nodes/{nodeId}/domain")] + [HttpGet] + public async Task GetApiBoundaryNodeDomain(string nodeId) + { + HttpResponseMessage httpResponse = await this.HttpClient.GetAsync($"/api_boundary_nodes/{nodeId}/domain"); + return this.Ok(await httpResponse.Content.ReadAsStringAsync()); + } + } +} From b825b5c0b3d9eb6344b656ae60f06a29d8066b1c Mon Sep 17 00:00:00 2001 From: Gekctek Date: Thu, 6 Mar 2025 15:30:00 -0800 Subject: [PATCH 14/20] Cleanup --- .../Sample.RestAPI/Controllers/ReplicaController.cs | 13 +------------ src/Agent/Agents/HttpAgent.cs | 8 +------- 2 files changed, 2 insertions(+), 19 deletions(-) diff --git a/samples/Sample.RestAPI/Controllers/ReplicaController.cs b/samples/Sample.RestAPI/Controllers/ReplicaController.cs index 05271064..2fe0e8e4 100644 --- a/samples/Sample.RestAPI/Controllers/ReplicaController.cs +++ b/samples/Sample.RestAPI/Controllers/ReplicaController.cs @@ -1,10 +1,6 @@ using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Agent.Responses; -using EdjCase.ICP.Candid.Models; using Microsoft.AspNetCore.Mvc; -using Sample.Shared.Governance; -using Sample.Shared.Governance.Models; -using System.Threading; namespace Sample.RestAPI.Controllers { @@ -30,13 +26,6 @@ public async Task GetRewards() StatusResponse status = await this.Agent.GetReplicaStatusAsync(); return this.Ok(status); } - - [Route("api_boundary_nodes/{nodeId}/domain")] - [HttpGet] - public async Task GetApiBoundaryNodeDomain(string nodeId) - { - HttpResponseMessage httpResponse = await this.HttpClient.GetAsync($"/api_boundary_nodes/{nodeId}/domain"); - return this.Ok(await httpResponse.Content.ReadAsStringAsync()); - } } + } diff --git a/src/Agent/Agents/HttpAgent.cs b/src/Agent/Agents/HttpAgent.cs index c4b762c5..cbfe92c0 100644 --- a/src/Agent/Agents/HttpAgent.cs +++ b/src/Agent/Agents/HttpAgent.cs @@ -1,20 +1,14 @@ using EdjCase.ICP.Agent.Models; -using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Agent.Requests; using EdjCase.ICP.Agent.Responses; -using EdjCase.ICP.Candid.Crypto; using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid.Utilities; using System; -using System.Collections.Generic; using System.Net.Http; using System.Threading.Tasks; using EdjCase.ICP.Agent.Agents.Http; using System.Formats.Cbor; -using EdjCase.ICP.BLS; using System.Threading; -using System.Security.Cryptography; -using Org.BouncyCastle.Asn1.Ocsp; namespace EdjCase.ICP.Agent.Agents { @@ -41,7 +35,7 @@ public HttpAgent(IHttpClient httpClient, bool skipCertificateValidation = false) /// If true, will skip response certificate validation. Defaults to false public HttpAgent(Uri? httpBoundryNodeUrl = null, bool skipCertificateValidation = false) { - this.httpClient = new DefaultHttpClient(new HttpClient() + this.httpClient = new DefaultHttpClient(new HttpClient { BaseAddress = httpBoundryNodeUrl ?? new Uri("https://icp-api.io/") }); From bb8230d85cc1f649c8e7330726a69ffd1b9056a4 Mon Sep 17 00:00:00 2001 From: Gekctek Date: Thu, 6 Mar 2025 15:37:13 -0800 Subject: [PATCH 15/20] Adding Agent Test project --- src/Agent/API.xml | 62 ++-- test/Agent.Tests/Agent.Tests.csproj | 29 ++ test/Agent.Tests/GlobalUsings.cs | 1 + test/Agent.Tests/HttpAgentTests.cs | 459 ++++++++++++++++++++++++++++ 4 files changed, 520 insertions(+), 31 deletions(-) create mode 100644 test/Agent.Tests/Agent.Tests.csproj create mode 100644 test/Agent.Tests/GlobalUsings.cs create mode 100644 test/Agent.Tests/HttpAgentTests.cs diff --git a/src/Agent/API.xml b/src/Agent/API.xml index 1020c52c..40684ae4 100644 --- a/src/Agent/API.xml +++ b/src/Agent/API.xml @@ -4,37 +4,6 @@ EdjCase.ICP.Agent - - - An `IAgent` implementation using HTTP to make requests to the IC - - - - Optional. Sets the http client to use, otherwise will use the default http client - If true, will skip response certificate validation. Defaults to false - - - Url to the boundry node to connect to. Defaults to `https://icp-api.io/` - If true, will skip response certificate validation. Defaults to false - - - - - - - - - - - - - - - - - - - The default http client to use with the built in `HttpClient` @@ -103,6 +72,37 @@ + + + An `IAgent` implementation using HTTP to make requests to the IC + + + + Optional. Sets the http client to use, otherwise will use the default http client + If true, will skip response certificate validation. Defaults to false + + + Url to the boundry node to connect to. Defaults to `https://icp-api.io/` + If true, will skip response certificate validation. Defaults to false + + + + + + + + + + + + + + + + + + + An agent is used to communicate with the Internet Computer with certain protocols that diff --git a/test/Agent.Tests/Agent.Tests.csproj b/test/Agent.Tests/Agent.Tests.csproj new file mode 100644 index 00000000..9344002b --- /dev/null +++ b/test/Agent.Tests/Agent.Tests.csproj @@ -0,0 +1,29 @@ + + + + net8.0 + enable + enable + + false + true + + + + + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + + + + + + diff --git a/test/Agent.Tests/GlobalUsings.cs b/test/Agent.Tests/GlobalUsings.cs new file mode 100644 index 00000000..8c927eb7 --- /dev/null +++ b/test/Agent.Tests/GlobalUsings.cs @@ -0,0 +1 @@ +global using Xunit; \ No newline at end of file diff --git a/test/Agent.Tests/HttpAgentTests.cs b/test/Agent.Tests/HttpAgentTests.cs new file mode 100644 index 00000000..6c5b00c3 --- /dev/null +++ b/test/Agent.Tests/HttpAgentTests.cs @@ -0,0 +1,459 @@ +using EdjCase.ICP.Agent; +using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Identities; +using EdjCase.ICP.Agent.Models; +using EdjCase.ICP.Agent.Requests; +using EdjCase.ICP.Agent.Responses; +using EdjCase.ICP.Candid; +using EdjCase.ICP.Candid.Models; +using EdjCase.ICP.Candid.Utilities; +using Moq; +using System; +using System.Formats.Cbor; +using System.Net; +using System.Threading; +using System.Threading.Tasks; +using Xunit; + +namespace Agent.Tests +{ + public class HttpAgentTests + { + private static readonly Principal canisterId = Principal.FromText("j4n55-giaaa-aaaap-qb3wq-cai"); + private static readonly IIdentity identity = IdentityUtil.GenerateEd25519Identity(); + private static readonly Uri boundaryNodeUrl = new Uri("https://icp-api.io/"); + private static readonly SubjectPublicKeyInfo rootPublicKey = SubjectPublicKeyInfo.MainNetRootPublicKey; + + [Fact] + public async Task CallAsync_SuccessfulResponse_ReturnsReply() + { + // Arrange + var httpClientMock = new Mock(); + var agent = new HttpAgent(httpClientMock.Object, skipCertificateValidation: true); + + var request = new CallRequest(canisterId, "greet", CandidArg.FromCandid()); + var signedContent = SignedContent.CreateAndSign(request, identity); + + var certificate = CreateCertificate(signedContent.RequestId, RequestStatus.CreateReplied(CandidArg.FromCandid("DIDL\0\01\01\x68\x65\x6c\x6c\x6f"))); + var response = new V3CallResponse(certificate); + + var responseBytes = SerializeV3CallResponse(response); + var httpResponse = CreateHttpResponse(HttpStatusCode.OK, responseBytes); + + httpClientMock.Setup(c => c.PostAsync( + It.Is(url => url.Contains("/api/v3/canister/")), + It.IsAny(), + It.IsAny())) + .ReturnsAsync(httpResponse); + + // Act + var result = await agent.CallAsync(signedContent); + + // Assert + Assert.NotNull(result); + Assert.Equal("hello", result.Decode()); + } + + [Fact] + public async Task CallAsync_NotFoundResponse_FallsBackToV2() + { + // Arrange + var httpClientMock = new Mock(); + var agent = new HttpAgent(httpClientMock.Object, skipCertificateValidation: true); + + var request = new CallRequest(canisterId, "greet", CandidArg.FromCandid()); + var signedContent = SignedContent.CreateAndSign(request, identity); + + // V3 returns 404 + httpClientMock.Setup(c => c.PostAsync( + It.Is(url => url.Contains("/api/v3/canister/")), + It.IsAny(), + It.IsAny())) + .ReturnsAsync(CreateHttpResponse(HttpStatusCode.NotFound, Array.Empty())); + + // V2 Call setup (returns 202 Accepted) + httpClientMock.Setup(c => c.PostAsync( + It.Is(url => url.Contains("/api/v2/canister/") && url.Contains("/call")), + It.IsAny(), + It.IsAny())) + .ReturnsAsync(CreateHttpResponse(HttpStatusCode.Accepted, Array.Empty())); + + // Read state setup for polling + var certificate = CreateCertificate(signedContent.RequestId, RequestStatus.CreateReplied(CandidArg.FromCandid("DIDL\0\01\01\x68\x65\x6c\x6c\x6f"))); + var readStateResponse = new ReadStateResponse(certificate); + var readStateResponseBytes = SerializeReadStateResponse(readStateResponse); + + httpClientMock.Setup(c => c.PostAsync( + It.Is(url => url.Contains("/api/v2/canister/") && url.Contains("/read_state")), + It.IsAny(), + It.IsAny())) + .ReturnsAsync(CreateHttpResponse(HttpStatusCode.OK, readStateResponseBytes)); + + // Act + var result = await agent.CallAsync(signedContent); + + // Assert + Assert.NotNull(result); + Assert.Equal("hello", result.Decode()); + } + + [Fact] + public async Task CallAsync_AcceptedResponse_PollsUntilComplete() + { + // Arrange + var httpClientMock = new Mock(); + var agent = new HttpAgent(httpClientMock.Object, skipCertificateValidation: true); + + var request = new CallRequest(canisterId, "greet", CandidArg.FromCandid()); + var signedContent = SignedContent.CreateAndSign(request, identity); + + // V3 returns 202 Accepted (requires polling) + httpClientMock.Setup(c => c.PostAsync( + It.Is(url => url.Contains("/api/v3/canister/")), + It.IsAny(), + It.IsAny())) + .ReturnsAsync(CreateHttpResponse(HttpStatusCode.Accepted, Array.Empty())); + + // Read state setup for polling + var certificate = CreateCertificate(signedContent.RequestId, RequestStatus.CreateReplied(CandidArg.FromCandid("DIDL\0\01\01\x68\x65\x6c\x6c\x6f"))); + var readStateResponse = new ReadStateResponse(certificate); + var readStateResponseBytes = SerializeReadStateResponse(readStateResponse); + + httpClientMock.Setup(c => c.PostAsync( + It.Is(url => url.Contains("/api/v2/canister/") && url.Contains("/read_state")), + It.IsAny(), + It.IsAny())) + .ReturnsAsync(CreateHttpResponse(HttpStatusCode.OK, readStateResponseBytes)); + + // Act + var result = await agent.CallAsync(signedContent); + + // Assert + Assert.NotNull(result); + Assert.Equal("hello", result.Decode()); + } + + [Fact] + public async Task CallAsync_RejectedResponse_ThrowsCallRejectedException() + { + // Arrange + var httpClientMock = new Mock(); + var agent = new HttpAgent(httpClientMock.Object, skipCertificateValidation: true); + + var request = new CallRequest(canisterId, "greet", CandidArg.FromCandid()); + var signedContent = SignedContent.CreateAndSign(request, identity); + + var certificate = CreateCertificate(signedContent.RequestId, + RequestStatus.CreateRejected(RejectCode.CanisterError, "Test error message", "TEST_ERROR")); + var response = new V3CallResponse(certificate); + + var responseBytes = SerializeV3CallResponse(response); + var httpResponse = CreateHttpResponse(HttpStatusCode.OK, responseBytes); + + httpClientMock.Setup(c => c.PostAsync( + It.Is(url => url.Contains("/api/v3/canister/")), + It.IsAny(), + It.IsAny())) + .ReturnsAsync(httpResponse); + + // Act & Assert + var exception = await Assert.ThrowsAsync( + async () => await agent.CallAsync(signedContent)); + + Assert.Equal(RejectCode.CanisterError, exception.Code); + Assert.Equal("Test error message", exception.Message); + Assert.Equal("TEST_ERROR", exception.ErrorCode); + } + + [Fact] + public async Task QueryAsync_SuccessfulResponse_ReturnsReply() + { + // Arrange + var httpClientMock = new Mock(); + var agent = new HttpAgent(httpClientMock.Object); + + var request = new QueryRequest(canisterId, "greet", CandidArg.FromCandid()); + var signedContent = SignedContent.CreateAndSign(request, identity); + + var response = new QueryResponse(QueryResponseType.Replied, + CandidArg.FromCandid("DIDL\0\01\01\x68\x65\x6c\x6c\x6f"), null, null, null); + + var responseBytes = SerializeQueryResponse(response); + var httpResponse = CreateHttpResponse(HttpStatusCode.OK, responseBytes); + + httpClientMock.Setup(c => c.PostAsync( + It.Is(url => url.Contains("/api/v2/canister/") && url.Contains("/query")), + It.IsAny(), + It.IsAny())) + .ReturnsAsync(httpResponse); + + // Act + var result = await agent.QueryAsync(signedContent); + + // Assert + Assert.NotNull(result); + Assert.Equal("hello", result.Decode()); + } + + [Fact] + public async Task QueryAsync_RejectedResponse_ThrowsCallRejectedException() + { + // Arrange + var httpClientMock = new Mock(); + var agent = new HttpAgent(httpClientMock.Object); + + var request = new QueryRequest(canisterId, "greet", CandidArg.FromCandid()); + var signedContent = SignedContent.CreateAndSign(request, identity); + + var response = new QueryResponse(QueryResponseType.Rejected, + null, RejectCode.CanisterError, "Test error message", "TEST_ERROR"); + + var responseBytes = SerializeQueryResponse(response); + var httpResponse = CreateHttpResponse(HttpStatusCode.OK, responseBytes); + + httpClientMock.Setup(c => c.PostAsync( + It.Is(url => url.Contains("/api/v2/canister/") && url.Contains("/query")), + It.IsAny(), + It.IsAny())) + .ReturnsAsync(httpResponse); + + // Act & Assert + var exception = await Assert.ThrowsAsync( + async () => await agent.QueryAsync(signedContent)); + + Assert.Equal(RejectCode.CanisterError, exception.Code); + Assert.Equal("Test error message", exception.Message); + Assert.Equal("TEST_ERROR", exception.ErrorCode); + } + + [Fact] + public async Task ReadStateAsync_SuccessfulResponse_ReturnsCertificate() + { + // Arrange + var httpClientMock = new Mock(); + var agent = new HttpAgent(httpClientMock.Object, skipCertificateValidation: true); + + var requestId = RequestId.FromRandom(); + var request = new ReadStateRequest(new[] { + StatePath.FromSegments("request_status", requestId.RawValue) + }); + var signedContent = SignedContent.CreateAndSign(request, identity); + + var certificate = CreateCertificate(requestId, RequestStatus.CreateReplied(CandidArg.FromCandid("DIDL\0\01\01\x68\x65\x6c\x6c\x6f"))); + var response = new ReadStateResponse(certificate); + var responseBytes = SerializeReadStateResponse(response); + + var httpResponse = CreateHttpResponse(HttpStatusCode.OK, responseBytes); + + httpClientMock.Setup(c => c.PostAsync( + It.Is(url => url.Contains("/api/v2/canister/") && url.Contains("/read_state")), + It.IsAny(), + It.IsAny())) + .ReturnsAsync(httpResponse); + + // Act + var result = await agent.ReadStateAsync(canisterId, signedContent); + + // Assert + Assert.NotNull(result); + Assert.NotNull(result.Certificate); + + var requestStatus = IAgentExtensions.ParseRequestStatus( + result.Certificate.Tree.GetValueOrDefault(StatePath.FromSegments("request_status", requestId.RawValue)) + ); + + Assert.Equal(RequestStatus.StatusType.Replied, requestStatus?.Type); + Assert.Equal("hello", requestStatus?.AsReplied().Decode()); + } + + [Fact] + public async Task GetRootKeyAsync_StatusResponse_ReturnsRootKey() + { + // Arrange + var httpClientMock = new Mock(); + var agent = new HttpAgent(httpClientMock.Object); + + // Mock status response with development root key + var rootKeyBytes = new byte[] { 0x30, 0x82, 0x01, 0x22, 0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x01, 0x05, 0x00 }; + var statusResponse = new StatusResponse( + ApiVersion: "v2", + RootKey: null, + DevelopmentRootKey: rootKeyBytes, + Implementations: Array.Empty() + ); + + var responseBytes = SerializeStatusResponse(statusResponse); + var httpResponse = CreateHttpResponse(HttpStatusCode.OK, responseBytes); + + httpClientMock.Setup(c => c.GetAsync( + It.Is(url => url.Contains("/api/v2/status")), + It.IsAny())) + .ReturnsAsync(httpResponse); + + // Act + var result = await agent.GetRootKeyAsync(); + + // Assert + Assert.NotNull(result); + // Compare DER encodings + Assert.Equal(rootKeyBytes, result.GetDerEncoding()); + } + + [Fact] + public async Task GetRootKeyAsync_NoDevRootKey_ReturnsMainNetKey() + { + // Arrange + var httpClientMock = new Mock(); + var agent = new HttpAgent(httpClientMock.Object); + + // Mock status response without development root key + var statusResponse = new StatusResponse( + ApiVersion: "v2", + RootKey: null, + DevelopmentRootKey: null, + Implementations: Array.Empty() + ); + + var responseBytes = SerializeStatusResponse(statusResponse); + var httpResponse = CreateHttpResponse(HttpStatusCode.OK, responseBytes); + + httpClientMock.Setup(c => c.GetAsync( + It.Is(url => url.Contains("/api/v2/status")), + It.IsAny())) + .ReturnsAsync(httpResponse); + + // Act + var result = await agent.GetRootKeyAsync(); + + // Assert + Assert.NotNull(result); + // Should be main net key + Assert.Equal(SubjectPublicKeyInfo.MainNetRootPublicKey.GetDerEncoding(), result.GetDerEncoding()); + } + + [Fact] + public async Task CallAsynchronousAsync_SuccessfulResponse_ReturnsRequestId() + { + // Arrange + var httpClientMock = new Mock(); + var agent = new HttpAgent(httpClientMock.Object); + + var request = new CallRequest(canisterId, "greet", CandidArg.FromCandid()); + var signedContent = SignedContent.CreateAndSign(request, identity); + + var httpResponse = CreateHttpResponse(HttpStatusCode.Accepted, Array.Empty()); + + httpClientMock.Setup(c => c.PostAsync( + It.Is(url => url.Contains("/api/v2/canister/") && url.Contains("/call")), + It.IsAny(), + It.IsAny())) + .ReturnsAsync(httpResponse); + + // Act + var result = await agent.CallAsynchronousAsync(signedContent); + + // Assert + Assert.Equal(signedContent.RequestId, result); + } + + [Fact] + public async Task CallAsynchronousAsync_RejectedResponse_ThrowsCallRejectedException() + { + // Arrange + var httpClientMock = new Mock(); + var agent = new HttpAgent(httpClientMock.Object); + + var request = new CallRequest(canisterId, "greet", CandidArg.FromCandid()); + var signedContent = SignedContent.CreateAndSign(request, identity); + + // Create rejected response + var rejectResponse = new CallRejectedResponse( + RejectCode.CanisterError, + "Test error message", + "TEST_ERROR" + ); + + var responseBytes = SerializeCallRejectedResponse(rejectResponse); + var httpResponse = CreateHttpResponse(HttpStatusCode.OK, responseBytes); + + httpClientMock.Setup(c => c.PostAsync( + It.Is(url => url.Contains("/api/v2/canister/") && url.Contains("/call")), + It.IsAny(), + It.IsAny())) + .ReturnsAsync(httpResponse); + + // Act & Assert + var exception = await Assert.ThrowsAsync( + async () => await agent.CallAsynchronousAsync(signedContent)); + + Assert.Equal(RejectCode.CanisterError, exception.Code); + Assert.Equal("Test error message", exception.Message); + Assert.Equal("TEST_ERROR", exception.ErrorCode); + } + + #region Helper Methods + + private static HttpResponse CreateHttpResponse(HttpStatusCode statusCode, byte[] content) + { + return new HttpResponse(statusCode, content); + } + + private static Certificate CreateCertificate(RequestId requestId, RequestStatus status) + { + var tree = HashTree.Empty(); + if (status != null) + { + tree = HashTree.Labeled( + "request_status", + HashTree.Labeled( + requestId.RawValue, + status.ToHashTree() + ) + ); + } + + // Create a dummy signature for testing + var signature = new byte[32]; + Array.Fill(signature, 1); + + return new Certificate(tree, signature); + } + + private static byte[] SerializeV3CallResponse(V3CallResponse response) + { + var writer = new CborWriter(); + response.ToCbor(writer); + return writer.Encode(); + } + + private static byte[] SerializeReadStateResponse(ReadStateResponse response) + { + var writer = new CborWriter(); + response.ToCbor(writer); + return writer.Encode(); + } + + private static byte[] SerializeQueryResponse(QueryResponse response) + { + var writer = new CborWriter(); + response.ToCbor(writer); + return writer.Encode(); + } + + private static byte[] SerializeStatusResponse(StatusResponse response) + { + var writer = new CborWriter(); + response.ToCbor(writer); + return writer.Encode(); + } + + private static byte[] SerializeCallRejectedResponse(CallRejectedResponse response) + { + var writer = new CborWriter(); + response.ToCbor(writer); + return writer.Encode(); + } + + #endregion + } +} From 9b3caa5c901086d78c2cb7040f76265721777e1b Mon Sep 17 00:00:00 2001 From: Gekctek Date: Thu, 6 Mar 2025 15:38:46 -0800 Subject: [PATCH 16/20] Adding Agent.Tests to solution --- ICP.sln | 7 ++++ src/Agent/API.xml | 62 +++++++++++++++--------------- test/Agent.Tests/HttpAgentTests.cs | 1 + 3 files changed, 39 insertions(+), 31 deletions(-) diff --git a/ICP.sln b/ICP.sln index 936c45e2..60303d4e 100644 --- a/ICP.sln +++ b/ICP.sln @@ -57,6 +57,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Sample.PocketIC", "samples\ EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PocketIC.Tests", "test\PocketIC.Tests\PocketIC.Tests.csproj", "{02D1DDA8-7A9A-4355-BE95-DE1720D56055}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Agent.Tests", "test\Agent.Tests\Agent.Tests.csproj", "{3F90FFFE-A2E6-4544-8387-F1EB8D4EBB2F}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -135,6 +137,10 @@ Global {02D1DDA8-7A9A-4355-BE95-DE1720D56055}.Debug|Any CPU.Build.0 = Debug|Any CPU {02D1DDA8-7A9A-4355-BE95-DE1720D56055}.Release|Any CPU.ActiveCfg = Release|Any CPU {02D1DDA8-7A9A-4355-BE95-DE1720D56055}.Release|Any CPU.Build.0 = Release|Any CPU + {3F90FFFE-A2E6-4544-8387-F1EB8D4EBB2F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {3F90FFFE-A2E6-4544-8387-F1EB8D4EBB2F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3F90FFFE-A2E6-4544-8387-F1EB8D4EBB2F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {3F90FFFE-A2E6-4544-8387-F1EB8D4EBB2F}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -153,6 +159,7 @@ Global {213F30BA-D147-4291-93A3-13A8A006126D} = {F71B8320-C279-4A79-A8D4-4039DB39D522} {E674253B-7B51-40D0-9F3D-805007174D31} = {7FADA9D9-5FDA-4CFB-8A53-A578A61FBBA9} {02D1DDA8-7A9A-4355-BE95-DE1720D56055} = {F71B8320-C279-4A79-A8D4-4039DB39D522} + {3F90FFFE-A2E6-4544-8387-F1EB8D4EBB2F} = {F71B8320-C279-4A79-A8D4-4039DB39D522} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {3103E11A-E792-49EE-98C5-B2F3709DB088} diff --git a/src/Agent/API.xml b/src/Agent/API.xml index 40684ae4..1020c52c 100644 --- a/src/Agent/API.xml +++ b/src/Agent/API.xml @@ -4,6 +4,37 @@ EdjCase.ICP.Agent + + + An `IAgent` implementation using HTTP to make requests to the IC + + + + Optional. Sets the http client to use, otherwise will use the default http client + If true, will skip response certificate validation. Defaults to false + + + Url to the boundry node to connect to. Defaults to `https://icp-api.io/` + If true, will skip response certificate validation. Defaults to false + + + + + + + + + + + + + + + + + + + The default http client to use with the built in `HttpClient` @@ -72,37 +103,6 @@ - - - An `IAgent` implementation using HTTP to make requests to the IC - - - - Optional. Sets the http client to use, otherwise will use the default http client - If true, will skip response certificate validation. Defaults to false - - - Url to the boundry node to connect to. Defaults to `https://icp-api.io/` - If true, will skip response certificate validation. Defaults to false - - - - - - - - - - - - - - - - - - - An agent is used to communicate with the Internet Computer with certain protocols that diff --git a/test/Agent.Tests/HttpAgentTests.cs b/test/Agent.Tests/HttpAgentTests.cs index 6c5b00c3..2923aff0 100644 --- a/test/Agent.Tests/HttpAgentTests.cs +++ b/test/Agent.Tests/HttpAgentTests.cs @@ -1,5 +1,6 @@ using EdjCase.ICP.Agent; using EdjCase.ICP.Agent.Agents; +using EdjCase.ICP.Agent.Agents.Http; using EdjCase.ICP.Agent.Identities; using EdjCase.ICP.Agent.Models; using EdjCase.ICP.Agent.Requests; From 49cf8ddd768fee4d4b8a82ee0e9b9b0ebe7584d1 Mon Sep 17 00:00:00 2001 From: Gekctek Date: Thu, 6 Mar 2025 21:59:15 -0800 Subject: [PATCH 17/20] SignedRequest --- src/Agent/API.xml | 228 ++++++++------- src/Agent/Agents/Http/IHttpClient.cs | 4 +- src/Agent/Agents/HttpAgent.cs | 33 ++- src/Agent/Agents/IAgent.cs | 117 +++++--- src/Agent/Identities/IIdentity.cs | 11 +- .../{SignedContent.cs => SignedRequest.cs} | 41 ++- src/Agent/Properties/AssemblyInfo.cs | 1 + src/Agent/Responses/V3CallResponse.cs | 23 +- src/Candid/API.xml | 21 +- src/Candid/Models/HashTree.cs | 36 ++- src/Candid/Properties/AssemblyInfo.cs | 1 + src/WebSockets/EdjCase.ICP.WebSockets.csproj | 3 - src/WebSockets/WebSocketAgent.cs | 4 +- test/Agent.Tests/Agent.Tests.csproj | 1 + test/Agent.Tests/HttpAgentTests.cs | 276 +++++++----------- test/Candid.Tests/SigningTests.cs | 2 +- test/WebSockets.Tests/WebSockets.Tests.csproj | 1 + 17 files changed, 422 insertions(+), 381 deletions(-) rename src/Agent/Models/{SignedContent.cs => SignedRequest.cs} (78%) diff --git a/src/Agent/API.xml b/src/Agent/API.xml index 1020c52c..6e95dd83 100644 --- a/src/Agent/API.xml +++ b/src/Agent/API.xml @@ -4,37 +4,6 @@ EdjCase.ICP.Agent - - - An `IAgent` implementation using HTTP to make requests to the IC - - - - Optional. Sets the http client to use, otherwise will use the default http client - If true, will skip response certificate validation. Defaults to false - - - Url to the boundry node to connect to. Defaults to `https://icp-api.io/` - If true, will skip response certificate validation. Defaults to false - - - - - - - - - - - - - - - - - - - The default http client to use with the built in `HttpClient` @@ -62,7 +31,7 @@ Sends a GET http request and awaits the response The url to send the GET request to - Optional. Token to cancel request + Optional. Token to cancel waiting on the response The http response @@ -71,7 +40,7 @@ The url to send the POST request to The CBOR encoded body to send - Optional. Token to cancel request + Optional. Token to cancel waiting on the response The http response @@ -103,46 +72,77 @@ + + + An `IAgent` implementation using HTTP to make requests to the IC + + + + Optional. Sets the http client to use, otherwise will use the default http client + If true, will skip response certificate validation. Defaults to false + + + Url to the boundry node to connect to. Defaults to `https://icp-api.io/` + If true, will skip response certificate validation. Defaults to false + + + + + + + + + + + + + + + + + + + An agent is used to communicate with the Internet Computer with certain protocols that are specific to an `IAgent` implementation - + Sends a call request to a canister with already signed content The signed content containing the call request Optional. Specifies the relevant canister id if calling the root canister - Optional. Token to cancel request + Optional. Token to cancel waiting on the response The candid arg response to the call - + Sends an asynchronous call request to a canister with already signed content The signed content containing the call request Optional. Specifies the relevant canister id if calling the root canister - Optional. Token to cancel request + Optional. Token to cancel waiting on the response The id of the request that can be used to look up its status with `GetRequestStatusAsync` - + Sends a query request to a canister with already signed content The signed content containing the query request Optional. Specifies the relevant canister id if calling the root canister - Optional. Token to cancel request + Optional. Token to cancel waiting on the response The response data of the query call - + Reads the state of a specified canister with already signed content Canister to read state for The signed content containing the read state request - Optional. Token to cancel request + Optional. Token to cancel waiting on the response A response that contains the certificate of the current canister state @@ -156,7 +156,7 @@ Gets the root public key of the current Internet Computer network - Optional. Token to cancel request + Optional. Token to cancel waiting on the response The root public key bytes @@ -164,7 +164,7 @@ Extension methods for the `IAgent` interface - + Gets the state of a specified canister with the subset of state information specified by the paths parameter @@ -173,10 +173,11 @@ Canister to read state for The state paths to get information for. Other state data will be pruned if not specified Optional. Identity to sign the request with - Optional. Token to cancel request + Optional. Token to cancel waiting on the response + Optional. The expiration of the request if not processed in time A response that contains the certificate of the current canister state - + Sends a call request to a specified canister method and gets the response candid arg back using /v3/../call and falls back to /v2/../call if the v3 is not available @@ -188,10 +189,11 @@ Optional. Identity to sign the request with Optional. If specified will make the request unique even with the same arguments Optional. Specifies the relevant canister id if calling the root canister - Optional. Token to cancel request + Optional. Token to cancel waiting on the response + Optional. The expiration of the request if not processed in time The id of the request that can be used to look up its status with `GetRequestStatusAsync` - + Sends a query request to a specified canister method @@ -202,10 +204,11 @@ Optional. If specified will make the request unique even with the same arguments Optional. Identity to sign the request with Optional. Specifies the relevant canister id if calling the root canister - Optional. Token to cancel request + Optional. Token to cancel waiting on the response + Optional. The expiration of the request if not processed in time The response data of the query call - + Sends a call request to a specified canister method and gets back an id of the request that is being processed using /v2/../call. This call does NOT wait for the request to be complete. @@ -218,10 +221,11 @@ Optional. Identity to sign the request with Optional. If specified will make the request unique even with the same arguments Optional. Specifies the relevant canister id if calling the root canister - Optional. Token to cancel request + Optional. Token to cancel waiting on the response + Optional. The expiration of the request if not processed in time The id of the request that can be used to look up its status with `GetRequestStatusAsync` - + Sends a call request to a specified canister method, waits for the request to be processed, the returns the candid response to the call. This is helper method built on top of `CallAsynchronousAsync` @@ -234,10 +238,11 @@ Optional. Identity to sign the request with Optional. If specified will make the request unique even with the same arguments Optional. Specifies the relevant canister id if calling the root canister - Optional. Token to cancel request + Optional. Token to cancel waiting on the response + Optional. The expiration of the request if not processed in time The raw candid arg response - + Sends a call request with already signed content to a specified canister method, waits for the request to be processed, then returns the candid response to the call. This is a helper method built on top of `CallAsynchronousAsync` @@ -246,10 +251,10 @@ The agent to use for the call The signed content containing the call request Optional. Specifies the relevant canister id if calling the root canister - Optional. Token to cancel request + Optional. Token to cancel waiting on the response The raw candid arg response - + Gets the status of a request that is being processed by the specified canister @@ -257,7 +262,8 @@ Canister where the request was sent to Id of the request to get a status for Optional. Identity to sign the request with - Optional. Token to cancel request + Optional. Token to cancel waiting on the response + Optional. The expiration of the request if not processed in time A status variant of the request. If request is not found, will return null @@ -269,7 +275,7 @@ The agent to use for the call Canister to read state for The unique identifier for the request - Optional. Token to cancel request + Optional. Token to cancel waiting on the response The raw candid arg response @@ -597,11 +603,11 @@ The byte data to sign The signature bytes of the specified data bytes - + Signs the hashable content - The data that needs to be signed + The data that needs to be signed The content with signature(s) from the identity @@ -770,54 +776,6 @@ Optional. List of pricipals where requests can originate from A delegation chain signed by the delegating identity - - - A model containing content and the signature information of it - - - - - The hash of the content used for request identification - - - - - The request that is signed - - - - - Public key used to authenticate this request, unless anonymous, then null - - - - - Optional. A chain of delegations, starting with the one signed by sender_pubkey - and ending with the one delegating to the key relating to sender_sig. - - - - - Signature to authenticate this request, unless anonymous, then null - - - - The hash of the content used for request identification - The content that is signed in the form of key value pairs - Public key used to authenticate this request, unless anonymous, then null - Optional. A chain of delegations, starting with the one signed by sender_pubkey - and ending with the one delegating to the key relating to sender_sig. - Signature to authenticate this request, unless anonymous, then null - - - - - - - Serializes this signed content object to CBOR (Concise Binary Object Representation) format. - - A byte array containing the CBOR-encoded representation of this object. - A delegation that has been signed by an identity @@ -862,6 +820,56 @@ + + + A model containing content and the signature information of it + + + + + The request that is signed + + + + + Public key used to authenticate this request, unless anonymous, then null + + + + + Optional. A chain of delegations, starting with the one signed by sender_pubkey + and ending with the one delegating to the key relating to sender_sig. + + + + + Signature to authenticate this request, unless anonymous, then null + + + + The content that is signed in the form of key value pairs + Public key used to authenticate this request, unless anonymous, then null + Optional. A chain of delegations, starting with the one signed by sender_pubkey + and ending with the one delegating to the key relating to sender_sig. + Optional. Precomputed request id to use, otherwise will build it + Signature to authenticate this request, unless anonymous, then null + + + + Get the unique id for the request, which is hash of the content + Builds the id on the first call and caches it for future calls + + The id for the request + + + + + + + Serializes this signed content object to CBOR (Concise Binary Object Representation) format. + + A byte array containing the CBOR-encoded representation of this object. + A model for making call requests to a canister @@ -1270,7 +1278,7 @@ - The status of the call ('replied', 'rejected', 'done) + The status of the call ('replied', 'rejected', etc..) @@ -1278,8 +1286,8 @@ The certificate data of the current canister state - - The status of the call ('replied', 'rejected', 'done) + + The status of the call ('replied', 'rejected', etc..) The certificate data of the current canister state diff --git a/src/Agent/Agents/Http/IHttpClient.cs b/src/Agent/Agents/Http/IHttpClient.cs index 95837a81..30337f15 100644 --- a/src/Agent/Agents/Http/IHttpClient.cs +++ b/src/Agent/Agents/Http/IHttpClient.cs @@ -17,7 +17,7 @@ public interface IHttpClient /// Sends a GET http request and awaits the response /// /// The url to send the GET request to - /// Optional. Token to cancel request + /// Optional. Token to cancel waiting on the response /// The http response Task GetAsync(string url, CancellationToken? cancellationToken = null); @@ -26,7 +26,7 @@ public interface IHttpClient /// /// The url to send the POST request to /// The CBOR encoded body to send - /// Optional. Token to cancel request + /// Optional. Token to cancel waiting on the response /// The http response Task PostAsync(string url, byte[] cborBody, CancellationToken? cancellationToken = null); } diff --git a/src/Agent/Agents/HttpAgent.cs b/src/Agent/Agents/HttpAgent.cs index cbfe92c0..e536bb9b 100644 --- a/src/Agent/Agents/HttpAgent.cs +++ b/src/Agent/Agents/HttpAgent.cs @@ -48,27 +48,28 @@ public HttpAgent(Uri? httpBoundryNodeUrl = null, bool skipCertificateValidation /// public async Task CallAsync( - SignedContent content, + SignedRequest request, Principal? effectiveCanisterId = null, CancellationToken? cancellationToken = null ) { - effectiveCanisterId ??= content.Request.CanisterId; + effectiveCanisterId ??= request.Content.CanisterId; string url = this.GetCallUrl(effectiveCanisterId, this.v3CallSupported); - HttpResponse httpResponse = await this.SendAsync(url, content, cancellationToken); + HttpResponse httpResponse = await this.SendAsync(url, request, cancellationToken); if (httpResponse.StatusCode == System.Net.HttpStatusCode.NotFound) { // If v3 is not available, fall back to v2 this.v3CallSupported = false; - return await this.CallAsynchronousAndWaitAsync(content, effectiveCanisterId, cancellationToken); + return await this.CallAsynchronousAndWaitAsync(request, effectiveCanisterId, cancellationToken); } + RequestId requestId = request.GetOrBuildRequestId(); if (httpResponse.StatusCode == System.Net.HttpStatusCode.Accepted) { // If request takes too long, then it will return 202 Accepted and polling is required - return await this.WaitForRequestAsync(content.Request.CanisterId, content.RequestId, cancellationToken); + return await this.WaitForRequestAsync(request.Content.CanisterId, requestId, cancellationToken); } await httpResponse.ThrowIfErrorAsync(); @@ -84,7 +85,7 @@ public async Task CallAsync( throw new InvalidCertificateException("Certificate signature does not match the IC public key"); } } - HashTree? requestStatusData = v3CallResponse.Certificate.Tree.GetValueOrDefault(StatePath.FromSegments("request_status", content.RequestId.RawValue)); + HashTree? requestStatusData = v3CallResponse.Certificate.Tree.GetValueOrDefault(StatePath.FromSegments("request_status", requestId.RawValue)); RequestStatus? requestStatus = IAgentExtensions.ParseRequestStatus(requestStatusData); switch (requestStatus?.Type) { @@ -106,15 +107,15 @@ public async Task CallAsync( /// public async Task CallAsynchronousAsync( - SignedContent content, + SignedRequest request, Principal? effectiveCanisterId = null, CancellationToken? cancellationToken = null ) { - effectiveCanisterId ??= content.Request.CanisterId; + effectiveCanisterId ??= request.Content.CanisterId; string url = this.GetCallUrl(effectiveCanisterId, false); - HttpResponse httpResponse = await this.SendAsync(url, content, cancellationToken); + HttpResponse httpResponse = await this.SendAsync(url, request, cancellationToken); await httpResponse.ThrowIfErrorAsync(); if (httpResponse.StatusCode == System.Net.HttpStatusCode.OK) @@ -136,18 +137,18 @@ public async Task CallAsynchronousAsync( } throw new CallRejectedException(response.Code, response.Message, response.ErrorCode); } - return content.RequestId; + return request.GetOrBuildRequestId(); } /// public async Task QueryAsync( - SignedContent content, + SignedRequest request, Principal? effectiveCanisterId = null, CancellationToken? cancellationToken = null ) { - effectiveCanisterId ??= content.Request.CanisterId; - HttpResponse httpResponse = await this.SendAsync($"/api/v2/canister/{effectiveCanisterId.ToText()}/query", content, cancellationToken); + effectiveCanisterId ??= request.Content.CanisterId; + HttpResponse httpResponse = await this.SendAsync($"/api/v2/canister/{effectiveCanisterId.ToText()}/query", request, cancellationToken); await httpResponse.ThrowIfErrorAsync(); byte[] cborBytes = await httpResponse.GetContentAsync(); return QueryResponse.ReadCbor(new CborReader(cborBytes)).ThrowOrGetReply(); @@ -156,7 +157,7 @@ public async Task QueryAsync( /// public async Task ReadStateAsync( Principal canisterId, - SignedContent content, + SignedRequest content, CancellationToken? cancellationToken = null ) { @@ -243,12 +244,12 @@ public async Task GetReplicaStatusAsync( private async Task SendAsync( string url, - SignedContent content, + SignedRequest request, CancellationToken? cancellationToken = null ) where TRequest : IRepresentationIndependentHashItem { - byte[] cborBody = content.ToCborBytes(); + byte[] cborBody = request.ToCborBytes(); #if DEBUG string hex = ByteUtil.ToHexString(cborBody); #endif diff --git a/src/Agent/Agents/IAgent.cs b/src/Agent/Agents/IAgent.cs index bdc1a834..a6c41960 100644 --- a/src/Agent/Agents/IAgent.cs +++ b/src/Agent/Agents/IAgent.cs @@ -25,10 +25,10 @@ public interface IAgent /// /// The signed content containing the call request /// Optional. Specifies the relevant canister id if calling the root canister - /// Optional. Token to cancel request + /// Optional. Token to cancel waiting on the response /// The candid arg response to the call Task CallAsync( - SignedContent content, + SignedRequest content, Principal? effectiveCanisterId = null, CancellationToken? cancellationToken = null ); @@ -38,10 +38,10 @@ Task CallAsync( /// /// The signed content containing the call request /// Optional. Specifies the relevant canister id if calling the root canister - /// Optional. Token to cancel request + /// Optional. Token to cancel waiting on the response /// The id of the request that can be used to look up its status with `GetRequestStatusAsync` Task CallAsynchronousAsync( - SignedContent content, + SignedRequest content, Principal? effectiveCanisterId = null, CancellationToken? cancellationToken = null ); @@ -51,10 +51,10 @@ Task CallAsynchronousAsync( /// /// The signed content containing the query request /// Optional. Specifies the relevant canister id if calling the root canister - /// Optional. Token to cancel request + /// Optional. Token to cancel waiting on the response /// The response data of the query call Task QueryAsync( - SignedContent content, + SignedRequest content, Principal? effectiveCanisterId = null, CancellationToken? cancellationToken = null ); @@ -64,11 +64,11 @@ Task QueryAsync( /// /// Canister to read state for /// The signed content containing the read state request - /// Optional. Token to cancel request + /// Optional. Token to cancel waiting on the response /// A response that contains the certificate of the current canister state Task ReadStateAsync( Principal canisterId, - SignedContent content, + SignedRequest content, CancellationToken? cancellationToken = null ); @@ -82,7 +82,7 @@ Task ReadStateAsync( /// /// Gets the root public key of the current Internet Computer network /// - /// Optional. Token to cancel request + /// Optional. Token to cancel waiting on the response /// The root public key bytes Task GetRootKeyAsync(CancellationToken? cancellationToken = null); } @@ -100,18 +100,22 @@ public static class IAgentExtensions /// Canister to read state for /// The state paths to get information for. Other state data will be pruned if not specified /// Optional. Identity to sign the request with - /// Optional. Token to cancel request + /// Optional. Token to cancel waiting on the response + /// Optional. The expiration of the request if not processed in time /// A response that contains the certificate of the current canister state public static async Task ReadStateAsync( this IAgent agent, Principal canisterId, List paths, IIdentity? identity = null, - CancellationToken? cancellationToken = null) + CancellationToken? cancellationToken = null, + ICTimestamp? ingressExpiry = null + ) { - SignedContent content = SignContent( + SignedRequest content = SignRequest( identity, - (sender, ingressExpiry) => new ReadStateRequest(paths, sender, ingressExpiry) + (sender, ingressExpiry) => new ReadStateRequest(paths, sender, ingressExpiry), + ingressExpiry ); return await agent.ReadStateAsync(canisterId, content, cancellationToken); } @@ -128,7 +132,8 @@ public static async Task ReadStateAsync( /// Optional. Identity to sign the request with /// Optional. If specified will make the request unique even with the same arguments /// Optional. Specifies the relevant canister id if calling the root canister - /// Optional. Token to cancel request + /// Optional. Token to cancel waiting on the response + /// Optional. The expiration of the request if not processed in time /// The id of the request that can be used to look up its status with `GetRequestStatusAsync` public static async Task CallAsync( this IAgent agent, @@ -138,15 +143,17 @@ public static async Task CallAsync( IIdentity? identity = null, byte[]? nonce = null, Principal? effectiveCanisterId = null, - CancellationToken? cancellationToken = null + CancellationToken? cancellationToken = null, + ICTimestamp? ingressExpiry = null ) { - SignedContent content = SignContent( + SignedRequest content = SignRequest( identity, (sender, ingressExpiry) => { return new CallRequest(canisterId, method, arg, sender, ingressExpiry, nonce); - } + }, + ingressExpiry ); return await agent.CallAsync(content, effectiveCanisterId, cancellationToken); } @@ -162,7 +169,8 @@ public static async Task CallAsync( /// Optional. If specified will make the request unique even with the same arguments /// Optional. Identity to sign the request with /// Optional. Specifies the relevant canister id if calling the root canister - /// Optional. Token to cancel request + /// Optional. Token to cancel waiting on the response + /// Optional. The expiration of the request if not processed in time /// The response data of the query call public static async Task QueryAsync( this IAgent agent, @@ -172,12 +180,14 @@ public static async Task QueryAsync( byte[]? nonce = null, IIdentity? identity = null, Principal? effectiveCanisterId = null, - CancellationToken? cancellationToken = null + CancellationToken? cancellationToken = null, + ICTimestamp? ingressExpiry = null ) { - SignedContent content = SignContent( + SignedRequest content = SignRequest( identity, - (sender, ingressExpiry) => new QueryRequest(canisterId, method, arg, sender, ingressExpiry, nonce) + (sender, ingressExpiry) => new QueryRequest(canisterId, method, arg, sender, ingressExpiry, nonce), + ingressExpiry ); return await agent.QueryAsync(content, effectiveCanisterId, cancellationToken); } @@ -195,7 +205,8 @@ public static async Task QueryAsync( /// Optional. Identity to sign the request with /// Optional. If specified will make the request unique even with the same arguments /// Optional. Specifies the relevant canister id if calling the root canister - /// Optional. Token to cancel request + /// Optional. Token to cancel waiting on the response + /// Optional. The expiration of the request if not processed in time /// The id of the request that can be used to look up its status with `GetRequestStatusAsync` public static async Task CallAsynchronousAsync( this IAgent agent, @@ -205,15 +216,17 @@ public static async Task CallAsynchronousAsync( IIdentity? identity = null, byte[]? nonce = null, Principal? effectiveCanisterId = null, - CancellationToken? cancellationToken = null + CancellationToken? cancellationToken = null, + ICTimestamp? ingressExpiry = null ) { - SignedContent content = SignContent( + SignedRequest content = SignRequest( identity, (sender, ingressExpiry) => { return new CallRequest(canisterId, method, arg, sender, ingressExpiry, nonce); - } + }, + ingressExpiry ); return await agent.CallAsynchronousAsync(content, effectiveCanisterId, cancellationToken); } @@ -231,7 +244,8 @@ public static async Task CallAsynchronousAsync( /// Optional. Identity to sign the request with /// Optional. If specified will make the request unique even with the same arguments /// Optional. Specifies the relevant canister id if calling the root canister - /// Optional. Token to cancel request + /// Optional. Token to cancel waiting on the response + /// Optional. The expiration of the request if not processed in time /// The raw candid arg response public static async Task CallAsynchronousAndWaitAsync( this IAgent agent, @@ -241,9 +255,20 @@ public static async Task CallAsynchronousAndWaitAsync( IIdentity? identity = null, byte[]? nonce = null, Principal? effectiveCanisterId = null, - CancellationToken? cancellationToken = null) + CancellationToken? cancellationToken = null, + ICTimestamp? ingressExpiry = null + ) { - RequestId id = await agent.CallAsynchronousAsync(canisterId, method, arg, identity, nonce, effectiveCanisterId, cancellationToken); + RequestId id = await agent.CallAsynchronousAsync( + canisterId, + method, + arg, + identity, + nonce, + effectiveCanisterId, + cancellationToken, + ingressExpiry + ); return await agent.WaitForRequestAsync(canisterId, id, cancellationToken); } @@ -255,16 +280,17 @@ public static async Task CallAsynchronousAndWaitAsync( /// The agent to use for the call /// The signed content containing the call request /// Optional. Specifies the relevant canister id if calling the root canister - /// Optional. Token to cancel request + /// Optional. Token to cancel waiting on the response /// The raw candid arg response public static async Task CallAsynchronousAndWaitAsync( this IAgent agent, - SignedContent content, + SignedRequest content, Principal? effectiveCanisterId = null, - CancellationToken? cancellationToken = null) + CancellationToken? cancellationToken = null + ) { RequestId id = await agent.CallAsynchronousAsync(content, effectiveCanisterId, cancellationToken); - return await agent.WaitForRequestAsync(content.Request.CanisterId, id, cancellationToken); + return await agent.WaitForRequestAsync(content.Content.CanisterId, id, cancellationToken); } @@ -275,19 +301,25 @@ public static async Task CallAsynchronousAndWaitAsync( /// Canister where the request was sent to /// Id of the request to get a status for /// Optional. Identity to sign the request with - /// Optional. Token to cancel request + /// Optional. Token to cancel waiting on the response + /// Optional. The expiration of the request if not processed in time /// A status variant of the request. If request is not found, will return null public static async Task GetRequestStatusAsync( this IAgent agent, Principal canisterId, RequestId id, IIdentity? identity = null, - CancellationToken? cancellationToken = null + CancellationToken? cancellationToken = null, + ICTimestamp? ingressExpiry = null ) { var pathRequestStatus = StatePath.FromSegments("request_status", id.RawValue); var paths = new List { pathRequestStatus }; - SignedContent signedContent = SignContent(identity, (sender, ingressExpiry) => new ReadStateRequest(paths, sender, ingressExpiry)); + SignedRequest signedContent = SignRequest( + identity, + (sender, ingressExpiry) => new ReadStateRequest(paths, sender, ingressExpiry), + ingressExpiry + ); ReadStateResponse response = await agent.ReadStateAsync(canisterId, signedContent, cancellationToken); HashTree? requestStatus = response.Certificate.Tree.GetValueOrDefault(pathRequestStatus); return ParseRequestStatus(requestStatus); @@ -301,7 +333,7 @@ public static async Task CallAsynchronousAndWaitAsync( /// The agent to use for the call /// Canister to read state for /// The unique identifier for the request - /// Optional. Token to cancel request + /// Optional. Token to cancel waiting on the response /// The raw candid arg response public static async Task WaitForRequestAsync( this IAgent agent, @@ -364,9 +396,10 @@ public static async Task WaitForRequestAsync( } - private static SignedContent SignContent( + private static SignedRequest SignRequest( IIdentity? identity, - Func getRequest + Func getRequest, + ICTimestamp? ingressExpiry = null ) where TRequest : IRepresentationIndependentHashItem { @@ -381,15 +414,13 @@ Func getRequest SubjectPublicKeyInfo publicKey = identity.GetPublicKey(); principal = publicKey.ToPrincipal(); } - TRequest request = getRequest(principal, ICTimestamp.Future(TimeSpan.FromMinutes(3))); + TRequest request = getRequest(principal, ingressExpiry ?? ICTimestamp.Future(TimeSpan.FromMinutes(3))); if (identity == null) { - var sha256 = SHA256HashFunction.Create(); - RequestId requestId = RequestId.FromObject(request.BuildHashableItem(), sha256); - return new SignedContent(requestId, request, null, null, null); + return new SignedRequest(request, null, null, null); } - return identity.SignContent(request); + return identity.Sign(request); } } diff --git a/src/Agent/Identities/IIdentity.cs b/src/Agent/Identities/IIdentity.cs index 47656f86..91947c8d 100644 --- a/src/Agent/Identities/IIdentity.cs +++ b/src/Agent/Identities/IIdentity.cs @@ -43,19 +43,18 @@ public interface IIdentity /// /// Signs the hashable content /// - /// The data that needs to be signed + /// The data that needs to be signed /// The content with signature(s) from the identity - public SignedContent SignContent(TRequest content) + public SignedRequest Sign(TRequest request) where TRequest : IRepresentationIndependentHashItem { SubjectPublicKeyInfo senderPublicKey = this.GetPublicKey(); var sha256 = SHA256HashFunction.Create(); - byte[] contentHash = content.BuildHashableItem().ToHashable().ComputeHash(sha256); - RequestId requestId = RequestId.FromBytes(contentHash); + RequestId requestId = RequestId.FromObject(request.BuildHashableItem(), sha256); byte[] domainSeparator = Encoding.UTF8.GetBytes("\x0Aic-request"); - byte[] senderSignature = this.Sign(domainSeparator.Concat(contentHash).ToArray()); + byte[] senderSignature = this.Sign([.. domainSeparator, .. requestId.RawValue]); List? senderDelegations = this.GetSenderDelegations(); - return new SignedContent(requestId, content, senderPublicKey, senderDelegations, senderSignature); + return new SignedRequest(request, senderPublicKey, senderDelegations, senderSignature, precomputedRequestId: requestId); } } } diff --git a/src/Agent/Models/SignedContent.cs b/src/Agent/Models/SignedRequest.cs similarity index 78% rename from src/Agent/Models/SignedContent.cs rename to src/Agent/Models/SignedRequest.cs index 588ba6e4..8aedd97c 100644 --- a/src/Agent/Models/SignedContent.cs +++ b/src/Agent/Models/SignedRequest.cs @@ -1,3 +1,5 @@ +using EdjCase.ICP.Agent.Identities; +using EdjCase.ICP.Candid.Crypto; using EdjCase.ICP.Candid.Models; using System; using System.Collections.Generic; @@ -9,18 +11,15 @@ namespace EdjCase.ICP.Agent.Models /// /// A model containing content and the signature information of it /// - public class SignedContent : IRepresentationIndependentHashItem + public class SignedRequest : IRepresentationIndependentHashItem where TRequest : IRepresentationIndependentHashItem { - /// - /// The hash of the content used for request identification - /// - public RequestId RequestId { get; } + private RequestId? requestIdCache; /// /// The request that is signed /// - public TRequest Request { get; } + public TRequest Content { get; } /// /// Public key used to authenticate this request, unless anonymous, then null @@ -38,25 +37,34 @@ public class SignedContent : IRepresentationIndependentHashItem /// public byte[]? SenderSignature { get; } - /// The hash of the content used for request identification - /// The content that is signed in the form of key value pairs + /// The content that is signed in the form of key value pairs /// Public key used to authenticate this request, unless anonymous, then null /// Optional. A chain of delegations, starting with the one signed by sender_pubkey /// and ending with the one delegating to the key relating to sender_sig. + /// Optional. Precomputed request id to use, otherwise will build it /// Signature to authenticate this request, unless anonymous, then null - public SignedContent( - RequestId requestId, - TRequest request, + public SignedRequest( + TRequest content, SubjectPublicKeyInfo? senderPublicKey, List? delegations, - byte[]? senderSignature + byte[]? senderSignature, + RequestId? precomputedRequestId = null ) { - this.RequestId = requestId ?? throw new ArgumentNullException(nameof(requestId)); - this.Request = request ?? throw new ArgumentNullException(nameof(request)); + this.Content = content ?? throw new ArgumentNullException(nameof(content)); this.SenderPublicKey = senderPublicKey; this.SenderDelegations = delegations; this.SenderSignature = senderSignature; + this.requestIdCache = precomputedRequestId; + } + /// + /// Get the unique id for the request, which is hash of the content + /// Builds the id on the first call and caches it for future calls + /// + /// The id for the request + public RequestId GetOrBuildRequestId() + { + return this.requestIdCache ?? RequestId.FromObject(this.Content.BuildHashableItem(), SHA256HashFunction.Create()); } /// @@ -64,7 +72,7 @@ public Dictionary BuildHashableItem() { var properties = new Dictionary { - {Properties.CONTENT, this.Request.BuildHashableItem().ToHashable()} + {Properties.CONTENT, this.Content.BuildHashableItem().ToHashable()} }; if (this.SenderPublicKey != null) { @@ -93,11 +101,12 @@ public byte[] ToCborBytes() return writer.Encode(); } + internal void WriteCbor(CborWriter writer) { writer.WriteStartMap(null); writer.WriteTextString(Properties.CONTENT); - Dictionary hashableContent = this.Request.BuildHashableItem(); + Dictionary hashableContent = this.Content.BuildHashableItem(); writer.WriteStartMap(hashableContent.Count); foreach ((string key, IHashable value) in hashableContent) { diff --git a/src/Agent/Properties/AssemblyInfo.cs b/src/Agent/Properties/AssemblyInfo.cs index 14aa3549..f89437bf 100644 --- a/src/Agent/Properties/AssemblyInfo.cs +++ b/src/Agent/Properties/AssemblyInfo.cs @@ -3,5 +3,6 @@ [assembly: InternalsVisibleTo("Candid.Tests")] [assembly: InternalsVisibleTo("WebSockets.Tests")] [assembly: InternalsVisibleTo("Performance.Tests")] +[assembly: InternalsVisibleTo("Agent.Tests")] [assembly: InternalsVisibleTo("EdjCase.ICP.WebSockets")] [assembly: InternalsVisibleTo("EdjCase.ICP.PocketIC")] diff --git a/src/Agent/Responses/V3CallResponse.cs b/src/Agent/Responses/V3CallResponse.cs index f148c633..ef8aa31a 100644 --- a/src/Agent/Responses/V3CallResponse.cs +++ b/src/Agent/Responses/V3CallResponse.cs @@ -12,20 +12,20 @@ namespace EdjCase.ICP.Agent.Responses public class V3CallResponse { /// - /// The status of the call ('replied', 'rejected', 'done) + /// The status of the call ('replied', 'rejected', etc..) /// - public string Status { get; } + public RequestStatus.StatusType Status { get; } /// /// The certificate data of the current canister state /// public Certificate Certificate { get; } - /// The status of the call ('replied', 'rejected', 'done) + /// The status of the call ('replied', 'rejected', etc..) /// The certificate data of the current canister state /// - public V3CallResponse(string status, Certificate certificate) + public V3CallResponse(RequestStatus.StatusType status, Certificate certificate) { - this.Status = status ?? throw new ArgumentNullException(nameof(status)); + this.Status = status; this.Certificate = certificate ?? throw new ArgumentNullException(nameof(certificate)); } @@ -37,7 +37,7 @@ internal static V3CallResponse ReadCbor(CborReader reader) throw new CborContentException("Expected self describe tag"); } Certificate? certificate = null; - string? status = null; + string? statusString = null; reader.ReadStartMap(); while (reader.PeekState() != CborReaderState.EndMap) { @@ -49,7 +49,7 @@ internal static V3CallResponse ReadCbor(CborReader reader) certificate = Certificate.FromCbor(certReader); break; case "status": - status = reader.ReadTextString(); + statusString = reader.ReadTextString(); break; default: Debug.WriteLine($"Unknown field '{field}' in v3 call response"); @@ -59,7 +59,7 @@ internal static V3CallResponse ReadCbor(CborReader reader) } reader.ReadEndMap(); - if (status == null) + if (statusString == null) { throw new CborContentException("Missing field: status"); } @@ -69,7 +69,12 @@ internal static V3CallResponse ReadCbor(CborReader reader) throw new CborContentException("Missing field: certificate"); } + if (!Enum.TryParse(statusString, true, out var status)) + { + throw new CborContentException($"Invalid status: {statusString}"); + } + return new V3CallResponse(status, certificate); } } -} \ No newline at end of file +} diff --git a/src/Candid/API.xml b/src/Candid/API.xml index 869ccdd8..83548de0 100644 --- a/src/Candid/API.xml +++ b/src/Candid/API.xml @@ -1413,7 +1413,7 @@ - A helper class that wraps around a byte array, giving functions to convert + A helper class that wraps around a byte array, giving functions to convert to common types like text and numbers @@ -1482,6 +1482,18 @@ The UTF8 string value to use with the encoded value + + + A helper method to implicitly convert an encoded value to an unbounded uint + + The encoded value to get the raw value from + + + + A helper method to implicitly convert an unbounded uint to an encoded value + + The unbounded uint value to use with the encoded value + Creates an encoded value from a utf8 string value @@ -1489,6 +1501,13 @@ UTF8 encoded string UTF8 encoded value + + + Creates an encoded value from an unbounded uint value + + Unbounded uint value + Unbounded uint encoded value + diff --git a/src/Candid/Models/HashTree.cs b/src/Candid/Models/HashTree.cs index 43989a5e..d65edc3d 100644 --- a/src/Candid/Models/HashTree.cs +++ b/src/Candid/Models/HashTree.cs @@ -257,7 +257,7 @@ public override string ToString() } /// - /// A helper class that wraps around a byte array, giving functions to convert + /// A helper class that wraps around a byte array, giving functions to convert /// to common types like text and numbers /// public class EncodedValue : IEquatable @@ -337,7 +337,8 @@ public bool Equals(byte[]? other) if (ReferenceEquals(other, null)) { return false; - }; + } + ; return this.Value.AsSpan().SequenceEqual(other); } @@ -403,6 +404,24 @@ public static implicit operator EncodedValue(string utf8Value) return EncodedValue.Utf8Value(utf8Value); } + /// + /// A helper method to implicitly convert an encoded value to an unbounded uint + /// + /// The encoded value to get the raw value from + public static implicit operator UnboundedUInt(EncodedValue value) + { + return value.AsNat(); + } + + /// + /// A helper method to implicitly convert an unbounded uint to an encoded value + /// + /// The unbounded uint value to use with the encoded value + public static implicit operator EncodedValue(UnboundedUInt value) + { + return EncodedValue.NatValue(value); + } + /// /// Creates an encoded value from a utf8 string value /// @@ -413,6 +432,16 @@ public static EncodedValue Utf8Value(string value) return Encoding.UTF8.GetBytes(value); } + /// + /// Creates an encoded value from an unbounded uint value + /// + /// Unbounded uint value + /// Unbounded uint encoded value + public static EncodedValue NatValue(UnboundedUInt value) + { + return LEB128.EncodeUnsigned(value); + } + internal static byte[] WithDomainSeperator(string value, params byte[][] encodedValues) { @@ -480,7 +509,8 @@ public bool Equals(HashTree? other) if (ReferenceEquals(other, null)) { return false; - }; + } + ; if (this.Type != other.Type) { return false; diff --git a/src/Candid/Properties/AssemblyInfo.cs b/src/Candid/Properties/AssemblyInfo.cs index f4f42ad6..cde6e1e0 100644 --- a/src/Candid/Properties/AssemblyInfo.cs +++ b/src/Candid/Properties/AssemblyInfo.cs @@ -4,6 +4,7 @@ [assembly: InternalsVisibleTo("BLS.Tests")] [assembly: InternalsVisibleTo("WebSockets.Tests")] [assembly: InternalsVisibleTo("Performance.Tests")] +[assembly: InternalsVisibleTo("Agent.Tests")] [assembly: InternalsVisibleTo("EdjCase.ICP.ClientGenerator")] [assembly: InternalsVisibleTo("EdjCase.ICP.Agent")] [assembly: InternalsVisibleTo("EdjCase.ICP.WebSockets")] diff --git a/src/WebSockets/EdjCase.ICP.WebSockets.csproj b/src/WebSockets/EdjCase.ICP.WebSockets.csproj index 0891040a..b2ed7d3b 100644 --- a/src/WebSockets/EdjCase.ICP.WebSockets.csproj +++ b/src/WebSockets/EdjCase.ICP.WebSockets.csproj @@ -25,9 +25,6 @@ - - - diff --git a/src/WebSockets/WebSocketAgent.cs b/src/WebSockets/WebSocketAgent.cs index c37b526f..ab2b5497 100644 --- a/src/WebSockets/WebSocketAgent.cs +++ b/src/WebSockets/WebSocketAgent.cs @@ -496,8 +496,8 @@ CancellationToken cancellationToken sender, ICTimestamp.Future(TimeSpan.FromSeconds(30)) ); - SignedContent signedContent = this.identity - .SignContent(request); + SignedRequest signedContent = this.identity + .Sign(request); CborWriter writer = new CborWriter(); writer.WriteStartMap(1); diff --git a/test/Agent.Tests/Agent.Tests.csproj b/test/Agent.Tests/Agent.Tests.csproj index 9344002b..d6a20c9f 100644 --- a/test/Agent.Tests/Agent.Tests.csproj +++ b/test/Agent.Tests/Agent.Tests.csproj @@ -20,6 +20,7 @@ runtime; build; native; contentfiles; analyzers; buildtransitive all + diff --git a/test/Agent.Tests/HttpAgentTests.cs b/test/Agent.Tests/HttpAgentTests.cs index 2923aff0..1486edd6 100644 --- a/test/Agent.Tests/HttpAgentTests.cs +++ b/test/Agent.Tests/HttpAgentTests.cs @@ -22,24 +22,24 @@ public class HttpAgentTests { private static readonly Principal canisterId = Principal.FromText("j4n55-giaaa-aaaap-qb3wq-cai"); private static readonly IIdentity identity = IdentityUtil.GenerateEd25519Identity(); - private static readonly Uri boundaryNodeUrl = new Uri("https://icp-api.io/"); + private static readonly Uri boundaryNodeUrl = new("https://icp-api.io/"); private static readonly SubjectPublicKeyInfo rootPublicKey = SubjectPublicKeyInfo.MainNetRootPublicKey; [Fact] public async Task CallAsync_SuccessfulResponse_ReturnsReply() { // Arrange - var httpClientMock = new Mock(); - var agent = new HttpAgent(httpClientMock.Object, skipCertificateValidation: true); + Mock httpClientMock = new(); + HttpAgent agent = new(httpClientMock.Object, skipCertificateValidation: true); - var request = new CallRequest(canisterId, "greet", CandidArg.FromCandid()); - var signedContent = SignedContent.CreateAndSign(request, identity); + Principal sender = identity.GetPrincipal(); + ICTimestamp ingressExpiry = ICTimestamp.Future(TimeSpan.FromMinutes(1)); + CallRequest request = new(canisterId, "greet", CandidArg.FromCandid(), sender, ingressExpiry); + SignedRequest signedContent = identity.Sign(request); - var certificate = CreateCertificate(signedContent.RequestId, RequestStatus.CreateReplied(CandidArg.FromCandid("DIDL\0\01\01\x68\x65\x6c\x6c\x6f"))); - var response = new V3CallResponse(certificate); - var responseBytes = SerializeV3CallResponse(response); - var httpResponse = CreateHttpResponse(HttpStatusCode.OK, responseBytes); + byte[] responseBytes = []; + HttpResponse httpResponse = CreateHttpResponse(HttpStatusCode.OK, responseBytes); httpClientMock.Setup(c => c.PostAsync( It.Is(url => url.Contains("/api/v3/canister/")), @@ -48,22 +48,24 @@ public async Task CallAsync_SuccessfulResponse_ReturnsReply() .ReturnsAsync(httpResponse); // Act - var result = await agent.CallAsync(signedContent); + CandidArg result = await agent.CallAsync(signedContent); // Assert Assert.NotNull(result); - Assert.Equal("hello", result.Decode()); + Assert.Equal("hello", result.ToObjects()); } [Fact] public async Task CallAsync_NotFoundResponse_FallsBackToV2() { // Arrange - var httpClientMock = new Mock(); - var agent = new HttpAgent(httpClientMock.Object, skipCertificateValidation: true); + Mock httpClientMock = new(); + HttpAgent agent = new(httpClientMock.Object, skipCertificateValidation: true); - var request = new CallRequest(canisterId, "greet", CandidArg.FromCandid()); - var signedContent = SignedContent.CreateAndSign(request, identity); + Principal sender = identity.GetPrincipal(); + ICTimestamp ingressExpiry = ICTimestamp.Future(TimeSpan.FromMinutes(1)); + CallRequest request = new(canisterId, "greet", CandidArg.FromCandid(), sender, ingressExpiry); + var signedContent = identity.Sign(request); // V3 returns 404 httpClientMock.Setup(c => c.PostAsync( @@ -79,10 +81,7 @@ public async Task CallAsync_NotFoundResponse_FallsBackToV2() It.IsAny())) .ReturnsAsync(CreateHttpResponse(HttpStatusCode.Accepted, Array.Empty())); - // Read state setup for polling - var certificate = CreateCertificate(signedContent.RequestId, RequestStatus.CreateReplied(CandidArg.FromCandid("DIDL\0\01\01\x68\x65\x6c\x6c\x6f"))); - var readStateResponse = new ReadStateResponse(certificate); - var readStateResponseBytes = SerializeReadStateResponse(readStateResponse); + byte[] readStateResponseBytes = []; httpClientMock.Setup(c => c.PostAsync( It.Is(url => url.Contains("/api/v2/canister/") && url.Contains("/read_state")), @@ -95,18 +94,20 @@ public async Task CallAsync_NotFoundResponse_FallsBackToV2() // Assert Assert.NotNull(result); - Assert.Equal("hello", result.Decode()); + Assert.Equal("hello", result.ToObjects()); } [Fact] public async Task CallAsync_AcceptedResponse_PollsUntilComplete() { // Arrange - var httpClientMock = new Mock(); - var agent = new HttpAgent(httpClientMock.Object, skipCertificateValidation: true); + Mock httpClientMock = new(); + HttpAgent agent = new(httpClientMock.Object, skipCertificateValidation: true); - var request = new CallRequest(canisterId, "greet", CandidArg.FromCandid()); - var signedContent = SignedContent.CreateAndSign(request, identity); + Principal sender = identity.GetPrincipal(); + ICTimestamp ingressExpiry = ICTimestamp.Future(TimeSpan.FromMinutes(1)); + CallRequest request = new(canisterId, "greet", CandidArg.FromCandid(), sender, ingressExpiry); + var signedContent = identity.Sign(request); // V3 returns 202 Accepted (requires polling) httpClientMock.Setup(c => c.PostAsync( @@ -115,10 +116,7 @@ public async Task CallAsync_AcceptedResponse_PollsUntilComplete() It.IsAny())) .ReturnsAsync(CreateHttpResponse(HttpStatusCode.Accepted, Array.Empty())); - // Read state setup for polling - var certificate = CreateCertificate(signedContent.RequestId, RequestStatus.CreateReplied(CandidArg.FromCandid("DIDL\0\01\01\x68\x65\x6c\x6c\x6f"))); - var readStateResponse = new ReadStateResponse(certificate); - var readStateResponseBytes = SerializeReadStateResponse(readStateResponse); + byte[] readStateResponseBytes = []; httpClientMock.Setup(c => c.PostAsync( It.Is(url => url.Contains("/api/v2/canister/") && url.Contains("/read_state")), @@ -131,25 +129,24 @@ public async Task CallAsync_AcceptedResponse_PollsUntilComplete() // Assert Assert.NotNull(result); - Assert.Equal("hello", result.Decode()); + Assert.Equal("hello", result.ToObjects()); } [Fact] public async Task CallAsync_RejectedResponse_ThrowsCallRejectedException() { // Arrange - var httpClientMock = new Mock(); - var agent = new HttpAgent(httpClientMock.Object, skipCertificateValidation: true); + Mock httpClientMock = new(); + HttpAgent agent = new(httpClientMock.Object, skipCertificateValidation: true); - var request = new CallRequest(canisterId, "greet", CandidArg.FromCandid()); - var signedContent = SignedContent.CreateAndSign(request, identity); + Principal sender = identity.GetPrincipal(); + ICTimestamp ingressExpiry = ICTimestamp.Future(TimeSpan.FromMinutes(1)); + CallRequest request = new(canisterId, "greet", CandidArg.FromCandid(), sender, ingressExpiry); + var signedContent = identity.Sign(request); - var certificate = CreateCertificate(signedContent.RequestId, - RequestStatus.CreateRejected(RejectCode.CanisterError, "Test error message", "TEST_ERROR")); - var response = new V3CallResponse(certificate); - var responseBytes = SerializeV3CallResponse(response); - var httpResponse = CreateHttpResponse(HttpStatusCode.OK, responseBytes); + byte[] responseBytes = []; + HttpResponse httpResponse = CreateHttpResponse(HttpStatusCode.OK, responseBytes); httpClientMock.Setup(c => c.PostAsync( It.Is(url => url.Contains("/api/v3/canister/")), @@ -161,7 +158,7 @@ public async Task CallAsync_RejectedResponse_ThrowsCallRejectedException() var exception = await Assert.ThrowsAsync( async () => await agent.CallAsync(signedContent)); - Assert.Equal(RejectCode.CanisterError, exception.Code); + Assert.Equal(RejectCode.CanisterError, exception.RejectCode); Assert.Equal("Test error message", exception.Message); Assert.Equal("TEST_ERROR", exception.ErrorCode); } @@ -170,17 +167,17 @@ public async Task CallAsync_RejectedResponse_ThrowsCallRejectedException() public async Task QueryAsync_SuccessfulResponse_ReturnsReply() { // Arrange - var httpClientMock = new Mock(); - var agent = new HttpAgent(httpClientMock.Object); + Mock httpClientMock = new(); + HttpAgent agent = new(httpClientMock.Object); - var request = new QueryRequest(canisterId, "greet", CandidArg.FromCandid()); - var signedContent = SignedContent.CreateAndSign(request, identity); + Principal sender = identity.GetPrincipal(); + ICTimestamp ingressExpiry = ICTimestamp.Future(TimeSpan.FromMinutes(1)); + QueryRequest request = new(canisterId, "greet", CandidArg.FromCandid(), sender, ingressExpiry); + var signedContent = identity.Sign(request); - var response = new QueryResponse(QueryResponseType.Replied, - CandidArg.FromCandid("DIDL\0\01\01\x68\x65\x6c\x6c\x6f"), null, null, null); - var responseBytes = SerializeQueryResponse(response); - var httpResponse = CreateHttpResponse(HttpStatusCode.OK, responseBytes); + byte[] responseBytes = []; + HttpResponse httpResponse = CreateHttpResponse(HttpStatusCode.OK, responseBytes); httpClientMock.Setup(c => c.PostAsync( It.Is(url => url.Contains("/api/v2/canister/") && url.Contains("/query")), @@ -193,24 +190,24 @@ public async Task QueryAsync_SuccessfulResponse_ReturnsReply() // Assert Assert.NotNull(result); - Assert.Equal("hello", result.Decode()); + Assert.Equal("hello", result.ToObjects()); } [Fact] public async Task QueryAsync_RejectedResponse_ThrowsCallRejectedException() { // Arrange - var httpClientMock = new Mock(); - var agent = new HttpAgent(httpClientMock.Object); + Mock httpClientMock = new(); + HttpAgent agent = new(httpClientMock.Object); - var request = new QueryRequest(canisterId, "greet", CandidArg.FromCandid()); - var signedContent = SignedContent.CreateAndSign(request, identity); + Principal sender = identity.GetPrincipal(); + ICTimestamp ingressExpiry = ICTimestamp.Future(TimeSpan.FromMinutes(1)); - var response = new QueryResponse(QueryResponseType.Rejected, - null, RejectCode.CanisterError, "Test error message", "TEST_ERROR"); + QueryRequest request = new(canisterId, "greet", CandidArg.FromCandid(), sender, ingressExpiry); + SignedRequest signedContent = identity.Sign(request); - var responseBytes = SerializeQueryResponse(response); - var httpResponse = CreateHttpResponse(HttpStatusCode.OK, responseBytes); + byte[] responseBytes = []; + HttpResponse httpResponse = CreateHttpResponse(HttpStatusCode.OK, responseBytes); httpClientMock.Setup(c => c.PostAsync( It.Is(url => url.Contains("/api/v2/canister/") && url.Contains("/query")), @@ -222,7 +219,7 @@ public async Task QueryAsync_RejectedResponse_ThrowsCallRejectedException() var exception = await Assert.ThrowsAsync( async () => await agent.QueryAsync(signedContent)); - Assert.Equal(RejectCode.CanisterError, exception.Code); + Assert.Equal(RejectCode.CanisterError, exception.RejectCode); Assert.Equal("Test error message", exception.Message); Assert.Equal("TEST_ERROR", exception.ErrorCode); } @@ -231,20 +228,22 @@ public async Task QueryAsync_RejectedResponse_ThrowsCallRejectedException() public async Task ReadStateAsync_SuccessfulResponse_ReturnsCertificate() { // Arrange - var httpClientMock = new Mock(); - var agent = new HttpAgent(httpClientMock.Object, skipCertificateValidation: true); + Mock httpClientMock = new(); + HttpAgent agent = new(httpClientMock.Object, skipCertificateValidation: true); + + RequestId requestId = RequestId.FromBytes(new byte[32]); - var requestId = RequestId.FromRandom(); - var request = new ReadStateRequest(new[] { + Principal sender = identity.GetPrincipal(); + ICTimestamp ingressExpiry = ICTimestamp.Future(TimeSpan.FromMinutes(1)); + List paths = [ StatePath.FromSegments("request_status", requestId.RawValue) - }); - var signedContent = SignedContent.CreateAndSign(request, identity); + ]; + ReadStateRequest request = new(paths, sender, ingressExpiry); + var signedContent = identity.Sign(request); - var certificate = CreateCertificate(requestId, RequestStatus.CreateReplied(CandidArg.FromCandid("DIDL\0\01\01\x68\x65\x6c\x6c\x6f"))); - var response = new ReadStateResponse(certificate); - var responseBytes = SerializeReadStateResponse(response); + byte[] responseBytes = []; - var httpResponse = CreateHttpResponse(HttpStatusCode.OK, responseBytes); + HttpResponse httpResponse = CreateHttpResponse(HttpStatusCode.OK, responseBytes); httpClientMock.Setup(c => c.PostAsync( It.Is(url => url.Contains("/api/v2/canister/") && url.Contains("/read_state")), @@ -259,32 +258,27 @@ public async Task ReadStateAsync_SuccessfulResponse_ReturnsCertificate() Assert.NotNull(result); Assert.NotNull(result.Certificate); - var requestStatus = IAgentExtensions.ParseRequestStatus( + RequestStatus? requestStatus = IAgentExtensions.ParseRequestStatus( result.Certificate.Tree.GetValueOrDefault(StatePath.FromSegments("request_status", requestId.RawValue)) ); Assert.Equal(RequestStatus.StatusType.Replied, requestStatus?.Type); - Assert.Equal("hello", requestStatus?.AsReplied().Decode()); + Assert.Equal("hello", requestStatus?.AsReplied().ToObjects()); } [Fact] public async Task GetRootKeyAsync_StatusResponse_ReturnsRootKey() { // Arrange - var httpClientMock = new Mock(); - var agent = new HttpAgent(httpClientMock.Object); + Mock httpClientMock = new(); + HttpAgent agent = new(httpClientMock.Object); // Mock status response with development root key - var rootKeyBytes = new byte[] { 0x30, 0x82, 0x01, 0x22, 0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x01, 0x05, 0x00 }; - var statusResponse = new StatusResponse( - ApiVersion: "v2", - RootKey: null, - DevelopmentRootKey: rootKeyBytes, - Implementations: Array.Empty() - ); + byte[] rootKeyBytes = new byte[] { 0x30, 0x82, 0x01, 0x22, 0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x01, 0x05, 0x00 }; - var responseBytes = SerializeStatusResponse(statusResponse); - var httpResponse = CreateHttpResponse(HttpStatusCode.OK, responseBytes); + + byte[] responseBytes = []; + HttpResponse httpResponse = CreateHttpResponse(HttpStatusCode.OK, responseBytes); httpClientMock.Setup(c => c.GetAsync( It.Is(url => url.Contains("/api/v2/status")), @@ -292,31 +286,32 @@ public async Task GetRootKeyAsync_StatusResponse_ReturnsRootKey() .ReturnsAsync(httpResponse); // Act - var result = await agent.GetRootKeyAsync(); + SubjectPublicKeyInfo result = await agent.GetRootKeyAsync(); // Assert Assert.NotNull(result); // Compare DER encodings - Assert.Equal(rootKeyBytes, result.GetDerEncoding()); + Assert.Equal(rootKeyBytes, result.ToDerEncoding()); } [Fact] public async Task GetRootKeyAsync_NoDevRootKey_ReturnsMainNetKey() { // Arrange - var httpClientMock = new Mock(); - var agent = new HttpAgent(httpClientMock.Object); + Mock httpClientMock = new(); + HttpAgent agent = new(httpClientMock.Object); // Mock status response without development root key - var statusResponse = new StatusResponse( - ApiVersion: "v2", - RootKey: null, - DevelopmentRootKey: null, - Implementations: Array.Empty() + StatusResponse statusResponse = new( + icApiVersion: null, + implementationSource: null, + implementationVersion: null, + implementationRevision: null, + developmentRootKey: null ); - var responseBytes = SerializeStatusResponse(statusResponse); - var httpResponse = CreateHttpResponse(HttpStatusCode.OK, responseBytes); + byte[] responseBytes = []; + HttpResponse httpResponse = CreateHttpResponse(HttpStatusCode.OK, responseBytes); httpClientMock.Setup(c => c.GetAsync( It.Is(url => url.Contains("/api/v2/status")), @@ -324,25 +319,28 @@ public async Task GetRootKeyAsync_NoDevRootKey_ReturnsMainNetKey() .ReturnsAsync(httpResponse); // Act - var result = await agent.GetRootKeyAsync(); + SubjectPublicKeyInfo result = await agent.GetRootKeyAsync(); // Assert Assert.NotNull(result); // Should be main net key - Assert.Equal(SubjectPublicKeyInfo.MainNetRootPublicKey.GetDerEncoding(), result.GetDerEncoding()); + Assert.Equal(SubjectPublicKeyInfo.MainNetRootPublicKey.ToDerEncoding(), result.ToDerEncoding()); } [Fact] public async Task CallAsynchronousAsync_SuccessfulResponse_ReturnsRequestId() { // Arrange - var httpClientMock = new Mock(); - var agent = new HttpAgent(httpClientMock.Object); + Mock httpClientMock = new(); + HttpAgent agent = new(httpClientMock.Object); - var request = new CallRequest(canisterId, "greet", CandidArg.FromCandid()); - var signedContent = SignedContent.CreateAndSign(request, identity); + Principal sender = identity.GetPrincipal(); + ICTimestamp ingressExpiry = ICTimestamp.Future(TimeSpan.FromMinutes(1)); + CallRequest request = new(canisterId, "greet", CandidArg.FromCandid(), sender, ingressExpiry); + var signedContent = identity.Sign(request); + RequestId requestId = signedContent.GetOrBuildRequestId(); - var httpResponse = CreateHttpResponse(HttpStatusCode.Accepted, Array.Empty()); + HttpResponse httpResponse = CreateHttpResponse(HttpStatusCode.Accepted, Array.Empty()); httpClientMock.Setup(c => c.PostAsync( It.Is(url => url.Contains("/api/v2/canister/") && url.Contains("/call")), @@ -354,28 +352,24 @@ public async Task CallAsynchronousAsync_SuccessfulResponse_ReturnsRequestId() var result = await agent.CallAsynchronousAsync(signedContent); // Assert - Assert.Equal(signedContent.RequestId, result); + Assert.Equal(requestId, result); } [Fact] public async Task CallAsynchronousAsync_RejectedResponse_ThrowsCallRejectedException() { // Arrange - var httpClientMock = new Mock(); - var agent = new HttpAgent(httpClientMock.Object); + Mock httpClientMock = new(); + HttpAgent agent = new(httpClientMock.Object); - var request = new CallRequest(canisterId, "greet", CandidArg.FromCandid()); - var signedContent = SignedContent.CreateAndSign(request, identity); + Principal sender = identity.GetPrincipal(); + ICTimestamp ingressExpiry = ICTimestamp.Future(TimeSpan.FromMinutes(1)); + CallRequest request = new(canisterId, "greet", CandidArg.FromCandid(), sender, ingressExpiry); + var signedContent = identity.Sign(request); - // Create rejected response - var rejectResponse = new CallRejectedResponse( - RejectCode.CanisterError, - "Test error message", - "TEST_ERROR" - ); - var responseBytes = SerializeCallRejectedResponse(rejectResponse); - var httpResponse = CreateHttpResponse(HttpStatusCode.OK, responseBytes); + byte[] responseBytes = []; + HttpResponse httpResponse = CreateHttpResponse(HttpStatusCode.OK, responseBytes); httpClientMock.Setup(c => c.PostAsync( It.Is(url => url.Contains("/api/v2/canister/") && url.Contains("/call")), @@ -387,7 +381,7 @@ public async Task CallAsynchronousAsync_RejectedResponse_ThrowsCallRejectedExcep var exception = await Assert.ThrowsAsync( async () => await agent.CallAsynchronousAsync(signedContent)); - Assert.Equal(RejectCode.CanisterError, exception.Code); + Assert.Equal(RejectCode.CanisterError, exception.RejectCode); Assert.Equal("Test error message", exception.Message); Assert.Equal("TEST_ERROR", exception.ErrorCode); } @@ -396,63 +390,7 @@ public async Task CallAsynchronousAsync_RejectedResponse_ThrowsCallRejectedExcep private static HttpResponse CreateHttpResponse(HttpStatusCode statusCode, byte[] content) { - return new HttpResponse(statusCode, content); - } - - private static Certificate CreateCertificate(RequestId requestId, RequestStatus status) - { - var tree = HashTree.Empty(); - if (status != null) - { - tree = HashTree.Labeled( - "request_status", - HashTree.Labeled( - requestId.RawValue, - status.ToHashTree() - ) - ); - } - - // Create a dummy signature for testing - var signature = new byte[32]; - Array.Fill(signature, 1); - - return new Certificate(tree, signature); - } - - private static byte[] SerializeV3CallResponse(V3CallResponse response) - { - var writer = new CborWriter(); - response.ToCbor(writer); - return writer.Encode(); - } - - private static byte[] SerializeReadStateResponse(ReadStateResponse response) - { - var writer = new CborWriter(); - response.ToCbor(writer); - return writer.Encode(); - } - - private static byte[] SerializeQueryResponse(QueryResponse response) - { - var writer = new CborWriter(); - response.ToCbor(writer); - return writer.Encode(); - } - - private static byte[] SerializeStatusResponse(StatusResponse response) - { - var writer = new CborWriter(); - response.ToCbor(writer); - return writer.Encode(); - } - - private static byte[] SerializeCallRejectedResponse(CallRejectedResponse response) - { - var writer = new CborWriter(); - response.ToCbor(writer); - return writer.Encode(); + return new HttpResponse(statusCode, () => Task.FromResult(content)); } #endregion diff --git a/test/Candid.Tests/SigningTests.cs b/test/Candid.Tests/SigningTests.cs index 2eb387c9..7395ea6f 100644 --- a/test/Candid.Tests/SigningTests.cs +++ b/test/Candid.Tests/SigningTests.cs @@ -46,7 +46,7 @@ public void Sign_QueryRequest() var ingressExpiry = ICTimestamp.FromNanoSeconds(1654598046354206365); var request = new QueryRequest(canisterId, method, arg, sender, ingressExpiry); - SignedContent signedContent = identity.SignContent(request); + SignedRequest signedContent = identity.Sign(request); string signatureHex = ByteUtil.ToHexString(signedContent.SenderSignature!); Snapshot.Match(signatureHex); diff --git a/test/WebSockets.Tests/WebSockets.Tests.csproj b/test/WebSockets.Tests/WebSockets.Tests.csproj index ceaf2ce2..5bcc06c7 100644 --- a/test/WebSockets.Tests/WebSockets.Tests.csproj +++ b/test/WebSockets.Tests/WebSockets.Tests.csproj @@ -20,6 +20,7 @@ runtime; build; native; contentfiles; analyzers; buildtransitive all + From 3da7e389334517945813a33c1da370d4f098bd34 Mon Sep 17 00:00:00 2001 From: Gekctek Date: Sat, 8 Mar 2025 17:59:52 -0800 Subject: [PATCH 18/20] Fixing status code check --- src/Agent/Agents/Http/IHttpClient.cs | 2 +- src/Agent/Agents/HttpAgent.cs | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Agent/Agents/Http/IHttpClient.cs b/src/Agent/Agents/Http/IHttpClient.cs index 30337f15..dd2c54f4 100644 --- a/src/Agent/Agents/Http/IHttpClient.cs +++ b/src/Agent/Agents/Http/IHttpClient.cs @@ -69,7 +69,7 @@ public async Task GetContentAsync() /// public async ValueTask ThrowIfErrorAsync() { - bool non2XXStatusCode = this.StatusCode >= HttpStatusCode.Ambiguous && this.StatusCode < HttpStatusCode.OK; + bool non2XXStatusCode = this.StatusCode >= HttpStatusCode.Ambiguous || this.StatusCode < HttpStatusCode.OK; if (non2XXStatusCode) { byte[] bytes = await this.GetContentAsync(); diff --git a/src/Agent/Agents/HttpAgent.cs b/src/Agent/Agents/HttpAgent.cs index e536bb9b..ce949954 100644 --- a/src/Agent/Agents/HttpAgent.cs +++ b/src/Agent/Agents/HttpAgent.cs @@ -151,6 +151,9 @@ public async Task QueryAsync( HttpResponse httpResponse = await this.SendAsync($"/api/v2/canister/{effectiveCanisterId.ToText()}/query", request, cancellationToken); await httpResponse.ThrowIfErrorAsync(); byte[] cborBytes = await httpResponse.GetContentAsync(); +#if DEBUG + string hex = ByteUtil.ToHexString(cborBytes); +#endif return QueryResponse.ReadCbor(new CborReader(cborBytes)).ThrowOrGetReply(); } From 6d9d032a3e681d7a3b96ec12cb8743f04b38f352 Mon Sep 17 00:00:00 2001 From: Gekctek Date: Sat, 8 Mar 2025 18:00:00 -0800 Subject: [PATCH 19/20] Update API.xml --- src/Agent/API.xml | 62 +++++++++++++++++++++++------------------------ 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/src/Agent/API.xml b/src/Agent/API.xml index 6e95dd83..f766c2a6 100644 --- a/src/Agent/API.xml +++ b/src/Agent/API.xml @@ -4,6 +4,37 @@ EdjCase.ICP.Agent + + + An `IAgent` implementation using HTTP to make requests to the IC + + + + Optional. Sets the http client to use, otherwise will use the default http client + If true, will skip response certificate validation. Defaults to false + + + Url to the boundry node to connect to. Defaults to `https://icp-api.io/` + If true, will skip response certificate validation. Defaults to false + + + + + + + + + + + + + + + + + + + The default http client to use with the built in `HttpClient` @@ -72,37 +103,6 @@ - - - An `IAgent` implementation using HTTP to make requests to the IC - - - - Optional. Sets the http client to use, otherwise will use the default http client - If true, will skip response certificate validation. Defaults to false - - - Url to the boundry node to connect to. Defaults to `https://icp-api.io/` - If true, will skip response certificate validation. Defaults to false - - - - - - - - - - - - - - - - - - - An agent is used to communicate with the Internet Computer with certain protocols that From 777395396d06b5dd6a1da9a4b67f37a6df8cb93b Mon Sep 17 00:00:00 2001 From: Gekctek Date: Tue, 18 Mar 2025 14:42:31 -0700 Subject: [PATCH 20/20] Disabling new broken tests --- .../Controllers/ReplicaController.cs | 16 + src/Agent/Agents/HttpAgent.cs | 3 + test/Agent.Tests/HttpAgentTests.cs | 719 +++++++++--------- 3 files changed, 379 insertions(+), 359 deletions(-) diff --git a/samples/Sample.RestAPI/Controllers/ReplicaController.cs b/samples/Sample.RestAPI/Controllers/ReplicaController.cs index 2fe0e8e4..b7fcffdf 100644 --- a/samples/Sample.RestAPI/Controllers/ReplicaController.cs +++ b/samples/Sample.RestAPI/Controllers/ReplicaController.cs @@ -1,6 +1,8 @@ using EdjCase.ICP.Agent.Agents; using EdjCase.ICP.Agent.Responses; +using EdjCase.ICP.Candid.Models; using Microsoft.AspNetCore.Mvc; +using Sample.Shared.Governance.Models; namespace Sample.RestAPI.Controllers { @@ -26,6 +28,20 @@ public async Task GetRewards() StatusResponse status = await this.Agent.GetReplicaStatusAsync(); return this.Ok(status); } + + [Route("canisterState/{canisterIdText}")] + [HttpGet] + public async Task GetA(string canisterIdText) + { + Principal canisterId = Principal.FromText(canisterIdText); + var candidServicePath = StatePath.FromSegments("canister", canisterId.Raw, "metadata", "candid:service"); + var paths = new List + { + candidServicePath + }; + ReadStateResponse response = await this.Agent.ReadStateAsync(canisterId, paths); + return this.Ok(response); + } } } diff --git a/src/Agent/Agents/HttpAgent.cs b/src/Agent/Agents/HttpAgent.cs index ce949954..a2561491 100644 --- a/src/Agent/Agents/HttpAgent.cs +++ b/src/Agent/Agents/HttpAgent.cs @@ -169,6 +169,9 @@ public async Task ReadStateAsync( await httpResponse.ThrowIfErrorAsync(); byte[] cborBytes = await httpResponse.GetContentAsync(); +#if DEBUG + string cborHex = ByteUtil.ToHexString(cborBytes); +#endif var reader = new CborReader(cborBytes); ReadStateResponse response = ReadStateResponse.ReadCbor(reader); diff --git a/test/Agent.Tests/HttpAgentTests.cs b/test/Agent.Tests/HttpAgentTests.cs index 1486edd6..1383562a 100644 --- a/test/Agent.Tests/HttpAgentTests.cs +++ b/test/Agent.Tests/HttpAgentTests.cs @@ -25,366 +25,367 @@ public class HttpAgentTests private static readonly Uri boundaryNodeUrl = new("https://icp-api.io/"); private static readonly SubjectPublicKeyInfo rootPublicKey = SubjectPublicKeyInfo.MainNetRootPublicKey; - [Fact] - public async Task CallAsync_SuccessfulResponse_ReturnsReply() - { - // Arrange - Mock httpClientMock = new(); - HttpAgent agent = new(httpClientMock.Object, skipCertificateValidation: true); - - Principal sender = identity.GetPrincipal(); - ICTimestamp ingressExpiry = ICTimestamp.Future(TimeSpan.FromMinutes(1)); - CallRequest request = new(canisterId, "greet", CandidArg.FromCandid(), sender, ingressExpiry); - SignedRequest signedContent = identity.Sign(request); - - - byte[] responseBytes = []; - HttpResponse httpResponse = CreateHttpResponse(HttpStatusCode.OK, responseBytes); - - httpClientMock.Setup(c => c.PostAsync( - It.Is(url => url.Contains("/api/v3/canister/")), - It.IsAny(), - It.IsAny())) - .ReturnsAsync(httpResponse); - - // Act - CandidArg result = await agent.CallAsync(signedContent); - - // Assert - Assert.NotNull(result); - Assert.Equal("hello", result.ToObjects()); - } - - [Fact] - public async Task CallAsync_NotFoundResponse_FallsBackToV2() - { - // Arrange - Mock httpClientMock = new(); - HttpAgent agent = new(httpClientMock.Object, skipCertificateValidation: true); - - Principal sender = identity.GetPrincipal(); - ICTimestamp ingressExpiry = ICTimestamp.Future(TimeSpan.FromMinutes(1)); - CallRequest request = new(canisterId, "greet", CandidArg.FromCandid(), sender, ingressExpiry); - var signedContent = identity.Sign(request); - - // V3 returns 404 - httpClientMock.Setup(c => c.PostAsync( - It.Is(url => url.Contains("/api/v3/canister/")), - It.IsAny(), - It.IsAny())) - .ReturnsAsync(CreateHttpResponse(HttpStatusCode.NotFound, Array.Empty())); - - // V2 Call setup (returns 202 Accepted) - httpClientMock.Setup(c => c.PostAsync( - It.Is(url => url.Contains("/api/v2/canister/") && url.Contains("/call")), - It.IsAny(), - It.IsAny())) - .ReturnsAsync(CreateHttpResponse(HttpStatusCode.Accepted, Array.Empty())); - - byte[] readStateResponseBytes = []; - - httpClientMock.Setup(c => c.PostAsync( - It.Is(url => url.Contains("/api/v2/canister/") && url.Contains("/read_state")), - It.IsAny(), - It.IsAny())) - .ReturnsAsync(CreateHttpResponse(HttpStatusCode.OK, readStateResponseBytes)); - - // Act - var result = await agent.CallAsync(signedContent); - - // Assert - Assert.NotNull(result); - Assert.Equal("hello", result.ToObjects()); - } - - [Fact] - public async Task CallAsync_AcceptedResponse_PollsUntilComplete() - { - // Arrange - Mock httpClientMock = new(); - HttpAgent agent = new(httpClientMock.Object, skipCertificateValidation: true); - - Principal sender = identity.GetPrincipal(); - ICTimestamp ingressExpiry = ICTimestamp.Future(TimeSpan.FromMinutes(1)); - CallRequest request = new(canisterId, "greet", CandidArg.FromCandid(), sender, ingressExpiry); - var signedContent = identity.Sign(request); - - // V3 returns 202 Accepted (requires polling) - httpClientMock.Setup(c => c.PostAsync( - It.Is(url => url.Contains("/api/v3/canister/")), - It.IsAny(), - It.IsAny())) - .ReturnsAsync(CreateHttpResponse(HttpStatusCode.Accepted, Array.Empty())); - - byte[] readStateResponseBytes = []; - - httpClientMock.Setup(c => c.PostAsync( - It.Is(url => url.Contains("/api/v2/canister/") && url.Contains("/read_state")), - It.IsAny(), - It.IsAny())) - .ReturnsAsync(CreateHttpResponse(HttpStatusCode.OK, readStateResponseBytes)); - - // Act - var result = await agent.CallAsync(signedContent); - - // Assert - Assert.NotNull(result); - Assert.Equal("hello", result.ToObjects()); - } - - [Fact] - public async Task CallAsync_RejectedResponse_ThrowsCallRejectedException() - { - // Arrange - Mock httpClientMock = new(); - HttpAgent agent = new(httpClientMock.Object, skipCertificateValidation: true); - - Principal sender = identity.GetPrincipal(); - ICTimestamp ingressExpiry = ICTimestamp.Future(TimeSpan.FromMinutes(1)); - CallRequest request = new(canisterId, "greet", CandidArg.FromCandid(), sender, ingressExpiry); - var signedContent = identity.Sign(request); - - - byte[] responseBytes = []; - HttpResponse httpResponse = CreateHttpResponse(HttpStatusCode.OK, responseBytes); - - httpClientMock.Setup(c => c.PostAsync( - It.Is(url => url.Contains("/api/v3/canister/")), - It.IsAny(), - It.IsAny())) - .ReturnsAsync(httpResponse); - - // Act & Assert - var exception = await Assert.ThrowsAsync( - async () => await agent.CallAsync(signedContent)); - - Assert.Equal(RejectCode.CanisterError, exception.RejectCode); - Assert.Equal("Test error message", exception.Message); - Assert.Equal("TEST_ERROR", exception.ErrorCode); - } - - [Fact] - public async Task QueryAsync_SuccessfulResponse_ReturnsReply() - { - // Arrange - Mock httpClientMock = new(); - HttpAgent agent = new(httpClientMock.Object); - - Principal sender = identity.GetPrincipal(); - ICTimestamp ingressExpiry = ICTimestamp.Future(TimeSpan.FromMinutes(1)); - QueryRequest request = new(canisterId, "greet", CandidArg.FromCandid(), sender, ingressExpiry); - var signedContent = identity.Sign(request); - - - byte[] responseBytes = []; - HttpResponse httpResponse = CreateHttpResponse(HttpStatusCode.OK, responseBytes); - - httpClientMock.Setup(c => c.PostAsync( - It.Is(url => url.Contains("/api/v2/canister/") && url.Contains("/query")), - It.IsAny(), - It.IsAny())) - .ReturnsAsync(httpResponse); - - // Act - var result = await agent.QueryAsync(signedContent); - - // Assert - Assert.NotNull(result); - Assert.Equal("hello", result.ToObjects()); - } - - [Fact] - public async Task QueryAsync_RejectedResponse_ThrowsCallRejectedException() - { - // Arrange - Mock httpClientMock = new(); - HttpAgent agent = new(httpClientMock.Object); - - Principal sender = identity.GetPrincipal(); - ICTimestamp ingressExpiry = ICTimestamp.Future(TimeSpan.FromMinutes(1)); - - QueryRequest request = new(canisterId, "greet", CandidArg.FromCandid(), sender, ingressExpiry); - SignedRequest signedContent = identity.Sign(request); - - byte[] responseBytes = []; - HttpResponse httpResponse = CreateHttpResponse(HttpStatusCode.OK, responseBytes); - - httpClientMock.Setup(c => c.PostAsync( - It.Is(url => url.Contains("/api/v2/canister/") && url.Contains("/query")), - It.IsAny(), - It.IsAny())) - .ReturnsAsync(httpResponse); - - // Act & Assert - var exception = await Assert.ThrowsAsync( - async () => await agent.QueryAsync(signedContent)); - - Assert.Equal(RejectCode.CanisterError, exception.RejectCode); - Assert.Equal("Test error message", exception.Message); - Assert.Equal("TEST_ERROR", exception.ErrorCode); - } - [Fact] - public async Task ReadStateAsync_SuccessfulResponse_ReturnsCertificate() - { - // Arrange - Mock httpClientMock = new(); - HttpAgent agent = new(httpClientMock.Object, skipCertificateValidation: true); - - RequestId requestId = RequestId.FromBytes(new byte[32]); - - Principal sender = identity.GetPrincipal(); - ICTimestamp ingressExpiry = ICTimestamp.Future(TimeSpan.FromMinutes(1)); - List paths = [ - StatePath.FromSegments("request_status", requestId.RawValue) - ]; - ReadStateRequest request = new(paths, sender, ingressExpiry); - var signedContent = identity.Sign(request); - - byte[] responseBytes = []; - - HttpResponse httpResponse = CreateHttpResponse(HttpStatusCode.OK, responseBytes); - - httpClientMock.Setup(c => c.PostAsync( - It.Is(url => url.Contains("/api/v2/canister/") && url.Contains("/read_state")), - It.IsAny(), - It.IsAny())) - .ReturnsAsync(httpResponse); - - // Act - var result = await agent.ReadStateAsync(canisterId, signedContent); - - // Assert - Assert.NotNull(result); - Assert.NotNull(result.Certificate); - - RequestStatus? requestStatus = IAgentExtensions.ParseRequestStatus( - result.Certificate.Tree.GetValueOrDefault(StatePath.FromSegments("request_status", requestId.RawValue)) - ); - - Assert.Equal(RequestStatus.StatusType.Replied, requestStatus?.Type); - Assert.Equal("hello", requestStatus?.AsReplied().ToObjects()); - } - - [Fact] - public async Task GetRootKeyAsync_StatusResponse_ReturnsRootKey() - { - // Arrange - Mock httpClientMock = new(); - HttpAgent agent = new(httpClientMock.Object); - - // Mock status response with development root key - byte[] rootKeyBytes = new byte[] { 0x30, 0x82, 0x01, 0x22, 0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x01, 0x05, 0x00 }; - - - byte[] responseBytes = []; - HttpResponse httpResponse = CreateHttpResponse(HttpStatusCode.OK, responseBytes); - - httpClientMock.Setup(c => c.GetAsync( - It.Is(url => url.Contains("/api/v2/status")), - It.IsAny())) - .ReturnsAsync(httpResponse); - - // Act - SubjectPublicKeyInfo result = await agent.GetRootKeyAsync(); - - // Assert - Assert.NotNull(result); - // Compare DER encodings - Assert.Equal(rootKeyBytes, result.ToDerEncoding()); - } - - [Fact] - public async Task GetRootKeyAsync_NoDevRootKey_ReturnsMainNetKey() - { - // Arrange - Mock httpClientMock = new(); - HttpAgent agent = new(httpClientMock.Object); - - // Mock status response without development root key - StatusResponse statusResponse = new( - icApiVersion: null, - implementationSource: null, - implementationVersion: null, - implementationRevision: null, - developmentRootKey: null - ); - - byte[] responseBytes = []; - HttpResponse httpResponse = CreateHttpResponse(HttpStatusCode.OK, responseBytes); - - httpClientMock.Setup(c => c.GetAsync( - It.Is(url => url.Contains("/api/v2/status")), - It.IsAny())) - .ReturnsAsync(httpResponse); - - // Act - SubjectPublicKeyInfo result = await agent.GetRootKeyAsync(); - - // Assert - Assert.NotNull(result); - // Should be main net key - Assert.Equal(SubjectPublicKeyInfo.MainNetRootPublicKey.ToDerEncoding(), result.ToDerEncoding()); - } - - [Fact] - public async Task CallAsynchronousAsync_SuccessfulResponse_ReturnsRequestId() - { - // Arrange - Mock httpClientMock = new(); - HttpAgent agent = new(httpClientMock.Object); - - Principal sender = identity.GetPrincipal(); - ICTimestamp ingressExpiry = ICTimestamp.Future(TimeSpan.FromMinutes(1)); - CallRequest request = new(canisterId, "greet", CandidArg.FromCandid(), sender, ingressExpiry); - var signedContent = identity.Sign(request); - RequestId requestId = signedContent.GetOrBuildRequestId(); - - HttpResponse httpResponse = CreateHttpResponse(HttpStatusCode.Accepted, Array.Empty()); - - httpClientMock.Setup(c => c.PostAsync( - It.Is(url => url.Contains("/api/v2/canister/") && url.Contains("/call")), - It.IsAny(), - It.IsAny())) - .ReturnsAsync(httpResponse); - - // Act - var result = await agent.CallAsynchronousAsync(signedContent); - - // Assert - Assert.Equal(requestId, result); - } - - [Fact] - public async Task CallAsynchronousAsync_RejectedResponse_ThrowsCallRejectedException() - { - // Arrange - Mock httpClientMock = new(); - HttpAgent agent = new(httpClientMock.Object); - - Principal sender = identity.GetPrincipal(); - ICTimestamp ingressExpiry = ICTimestamp.Future(TimeSpan.FromMinutes(1)); - CallRequest request = new(canisterId, "greet", CandidArg.FromCandid(), sender, ingressExpiry); - var signedContent = identity.Sign(request); - - - byte[] responseBytes = []; - HttpResponse httpResponse = CreateHttpResponse(HttpStatusCode.OK, responseBytes); - - httpClientMock.Setup(c => c.PostAsync( - It.Is(url => url.Contains("/api/v2/canister/") && url.Contains("/call")), - It.IsAny(), - It.IsAny())) - .ReturnsAsync(httpResponse); - - // Act & Assert - var exception = await Assert.ThrowsAsync( - async () => await agent.CallAsynchronousAsync(signedContent)); - - Assert.Equal(RejectCode.CanisterError, exception.RejectCode); - Assert.Equal("Test error message", exception.Message); - Assert.Equal("TEST_ERROR", exception.ErrorCode); - } + //[Fact] + //public async Task CallAsync_SuccessfulResponse_ReturnsReply() + //{ + // // Arrange + // Mock httpClientMock = new(); + // HttpAgent agent = new(httpClientMock.Object, skipCertificateValidation: true); + + // Principal sender = identity.GetPrincipal(); + // ICTimestamp ingressExpiry = ICTimestamp.Future(TimeSpan.FromMinutes(1)); + // CallRequest request = new(canisterId, "greet", CandidArg.FromCandid(), sender, ingressExpiry); + // SignedRequest signedContent = identity.Sign(request); + + + // byte[] responseBytes = []; + // HttpResponse httpResponse = CreateHttpResponse(HttpStatusCode.OK, responseBytes); + + // httpClientMock.Setup(c => c.PostAsync( + // It.Is(url => url.Contains("/api/v3/canister/")), + // It.IsAny(), + // It.IsAny())) + // .ReturnsAsync(httpResponse); + + // // Act + // CandidArg result = await agent.CallAsync(signedContent); + + // // Assert + // Assert.NotNull(result); + // Assert.Equal("hello", result.ToObjects()); + //} + + //[Fact] + //public async Task CallAsync_NotFoundResponse_FallsBackToV2() + //{ + // // Arrange + // Mock httpClientMock = new(); + // HttpAgent agent = new(httpClientMock.Object, skipCertificateValidation: true); + + // Principal sender = identity.GetPrincipal(); + // ICTimestamp ingressExpiry = ICTimestamp.Future(TimeSpan.FromMinutes(1)); + // CallRequest request = new(canisterId, "greet", CandidArg.FromCandid(), sender, ingressExpiry); + // var signedContent = identity.Sign(request); + + // // V3 returns 404 + // httpClientMock.Setup(c => c.PostAsync( + // It.Is(url => url.Contains("/api/v3/canister/")), + // It.IsAny(), + // It.IsAny())) + // .ReturnsAsync(CreateHttpResponse(HttpStatusCode.NotFound, Array.Empty())); + + // // V2 Call setup (returns 202 Accepted) + // httpClientMock.Setup(c => c.PostAsync( + // It.Is(url => url.Contains("/api/v2/canister/") && url.Contains("/call")), + // It.IsAny(), + // It.IsAny())) + // .ReturnsAsync(CreateHttpResponse(HttpStatusCode.Accepted, Array.Empty())); + + // byte[] readStateResponseBytes = []; + + // httpClientMock.Setup(c => c.PostAsync( + // It.Is(url => url.Contains("/api/v2/canister/") && url.Contains("/read_state")), + // It.IsAny(), + // It.IsAny())) + // .ReturnsAsync(CreateHttpResponse(HttpStatusCode.OK, readStateResponseBytes)); + + // // Act + // var result = await agent.CallAsync(signedContent); + + // // Assert + // Assert.NotNull(result); + // Assert.Equal("hello", result.ToObjects()); + //} + + //[Fact] + //public async Task CallAsync_AcceptedResponse_PollsUntilComplete() + //{ + // // Arrange + // Mock httpClientMock = new(); + // HttpAgent agent = new(httpClientMock.Object, skipCertificateValidation: true); + + // Principal sender = identity.GetPrincipal(); + // ICTimestamp ingressExpiry = ICTimestamp.Future(TimeSpan.FromMinutes(1)); + // CallRequest request = new(canisterId, "greet", CandidArg.FromCandid(), sender, ingressExpiry); + // var signedContent = identity.Sign(request); + + // // V3 returns 202 Accepted (requires polling) + // httpClientMock.Setup(c => c.PostAsync( + // It.Is(url => url.Contains("/api/v3/canister/")), + // It.IsAny(), + // It.IsAny())) + // .ReturnsAsync(CreateHttpResponse(HttpStatusCode.Accepted, Array.Empty())); + + // byte[] readStateResponseBytes = ByteUtil.FromHexString("D9D9F7A16B6365727469666963617465594DC5D9D9F7A36474726565830183018301820458207F795EAF211FB3DA321D2291429BAD43A869A1CCFD761FF5A35F1A362322A1F483024863616E69737465728301830183018301820458205DB6DC6606E09F81ACC75F54F096750D2E63CFA34528BE44040BEDE7137149C2830183018204582040A85BCCB78A25B93D1154E18C5B047227B61A6A22493A4F6AB2167688EE7A908301820458203576B24290DC3A0A5F9B0B007098827B5C2D338C7A89BAEA5A2DAFCF4361892F830183018204582084B8551B9282C2E6ACB665107E7D1B911D5E976439221BB660F470DA10C2C51A8301820458209C4A97A85895A1309261D478A383D0D55FAF0208A7D236354298E3A4DCAD53CD830183018204582064E057E3C9CDE4ED9CECC84B551DE25B198C9C13C2F315BEC964D4C86BBE4F928301820458208AB9D29BC893D62F3EE176019CF5D0C7AD5068E0D893CBD5A39C2C5158386C288301830182045820394DE8F005405C223BFDF78AB9009808FBB4FAEDC6015B7F4A1758EECF6D7379830183024A00000000015018AE0101830182045820782E7694D678049DDDC835BC9FAD6348AF413B557F091D8860ABB3185214983483018302486D6574616461746183018301830182045820E8071E9C904063629F9AB66D4A447B7A881A964D16757762F424D2EF6C6A776B83024E63616E6469643A7365727669636582035946E174797065205A6F6E65446966666963756C7479203D200A2076617269616E74207B0A202020656173793B0A202020686172643B0A2020206D656469756D3B0A207D3B0A74797065205A6F6E65203D200A207265636F7264207B0A2020206465736372697074696F6E3A20746578743B0A202020646966666963756C74793A205A6F6E65446966666963756C74793B0A20202069643A20746578743B0A2020206E616D653A20746578743B0A202020756E6C6F636B526571756972656D656E743A20556E6C6F636B526571756972656D656E743B0A207D3B0A7479706520576F726C6450726F706F73616C203D200A207265636F7264207B0A202020636F6E74656E743A2050726F706F73616C436F6E74656E743B0A20202069643A206E61743B0A20202070726F706F73657249643A207072696E636970616C3B0A2020207374617475733A2050726F706F73616C5374617475733B0A20202074696D65456E643A206F707420696E743B0A20202074696D6553746172743A20696E743B0A202020766F7465733A20766563207265636F7264207B0A202020202020202020202020202020207072696E636970616C3B0A20202020202020202020202020202020566F74653B0A20202020202020202020202020207D3B0A207D3B0A747970652057656967687465645363656E6172696F506174684F7074696F6E203D200A207265636F7264207B0A2020206465736372697074696F6E3A20746578743B0A202020656666656374733A2076656320506174684566666563743B0A2020207061746849643A206F707420746578743B0A2020207765696768743A204F7074696F6E5765696768743B0A207D3B0A74797065205765696768744B696E64203D200A2076617269616E74207B0A2020206174747269627574655363616C65643A204174747269627574653B0A2020207261773B0A207D3B0A7479706520576561706F6E203D200A207265636F7264207B0A202020616374696F6E4964733A2076656320746578743B0A2020206465736372697074696F6E3A20746578743B0A20202069643A20746578743B0A202020696D6167653A20506978656C496D6167653B0A2020206E616D653A20746578743B0A202020756E6C6F636B526571756972656D656E743A20556E6C6F636B526571756972656D656E743B0A207D3B0A7479706520566F74654F6E576F726C6450726F706F73616C526573756C74203D200A2076617269616E74207B0A2020206572723A20566F74654F6E576F726C6450726F706F73616C4572726F723B0A2020206F6B3B0A207D3B0A7479706520566F74654F6E576F726C6450726F706F73616C52657175657374203D200A207265636F7264207B0A20202070726F706F73616C49643A206E61743B0A202020766F74653A20626F6F6C3B0A207D3B0A7479706520566F74654F6E576F726C6450726F706F73616C4572726F72203D200A2076617269616E74207B0A202020616C7265616479566F7465643B0A2020206E6F74456C696769626C653B0A20202070726F706F73616C4E6F74466F756E643B0A202020766F74696E67436C6F7365643B0A207D3B0A7479706520566F7465203D200A207265636F7264207B0A20202063686F6963653A206F707420626F6F6C3B0A202020766F74696E67506F7765723A206E61743B0A207D3B0A7479706520566963746F727947616D654F7574636F6D65576974684D65746144617461203D200A207265636F7264207B0A2020206368617261637465723A20436861726163746572576974684D657461446174613B0A202020756E6C6F636B6564416368696576656D656E744964733A2076656320746578743B0A207D3B0A7479706520557365725374617473203D207265636F7264207B75736572436F756E743A206E61743B7D3B0A747970652055736572203D200A207265636F7264207B0A202020616368696576656D656E744964733A2076656320746578743B0A20202063726561746554696D653A2054696D653B0A20202069643A207072696E636970616C3B0A202020706F696E74733A206E61743B0A207D3B0A7479706520556E6C6F636B526571756972656D656E74203D200A2076617269616E74207B0A202020616368696576656D656E7449643A20746578743B0A2020206E6F6E653B0A207D3B0A74797065205475726E5068617365203D200A2076617269616E74207B0A202020656E643B0A20202073746172743B0A207D3B0A747970652054696D65203D20696E743B0A74797065205461726765744B696E64203D200A2076617269616E74207B0A2020206368617261637465723B0A20202063726561747572653A206E61743B0A202020706572696F6469634566666563743B0A207D3B0A747970652053776170576561706F6E4F7574636F6D65456666656374203D200A207265636F7264207B0A20202072656D6F766564576561706F6E49643A20746578743B0A202020776561706F6E49643A20746578743B0A207D3B0A7479706520537461747573456666656374526573756C744B696E64203D200A2076617269616E74207B0A20202062726974746C653B0A2020206E6563726F7469633B0A202020706572696F6469633A20506572696F646963456666656374526573756C743B0A202020726574616C696174696E673A20526574616C696174696E673B0A2020207374756E6E65643B0A20202076756C6E657261626C653B0A2020207765616B3B0A207D3B0A7479706520537461747573456666656374526573756C74203D200A207265636F7264207B0A2020206B696E643A20537461747573456666656374526573756C744B696E643B0A20202072656D61696E696E675475726E733A206E61743B0A207D3B0A74797065205374617475734566666563744C6F67456E747279203D200A207265636F7264207B0A202020736F757263653A205461726765744B696E643B0A2020207374617475734566666563743A20537461747573456666656374526573756C743B0A2020207461726765743A205461726765744B696E643B0A207D3B0A74797065205374617475734566666563744B696E64203D200A2076617269616E74207B0A20202062726974746C653B0A2020206E6563726F7469633B0A202020726574616C696174696E673A20526574616C696174696E673B0A2020207374756E6E65643B0A20202076756C6E657261626C653B0A2020207765616B3B0A207D3B0A7479706520537461747573456666656374203D200A207265636F7264207B0A2020206475726174696F6E3A206F7074206E61743B0A2020206B696E643A205374617475734566666563744B696E643B0A207D3B0A74797065205374617274696E6747616D655374617465576974684D65746144617461203D207265636F7264207B0A2020202020202020202020202020202020202020202020202020202020202020202020202020206368617261637465724F7074696F6E733A0A2020202020202020202020202020202020202020202020202020202020202020202020202020202076656320436861726163746572576974684D657461446174613B7D3B0A7479706520537461727447616D65526573756C74203D200A2076617269616E74207B0A2020206572723A2076617269616E74207B0A20202020202020202020616C7265616479537461727465643B0A2020202020202020202067616D654E6F74466F756E643B0A20202020202020202020696E76616C696443686172616374657249643B0A20202020202020207D3B0A2020206F6B3B0A207D3B0A7479706520537461727447616D6552657175657374203D207265636F7264207B63686172616374657249643A206E61743B7D3B0A7479706520537461676543686F6963654B696E64203D200A2076617269616E74207B0A20202063686F6963653A20746578743B0A202020636F6D6261743A20436F6D62617443686F6963653B0A2020207265776172643A2052657761726443686F6963653B0A207D3B0A747970652053656C6563745363656E6172696F43686F696365526573756C74203D200A2076617269616E74207B0A2020206572723A2053656C6563745363656E6172696F43686F6963654572726F723B0A2020206F6B3B0A207D3B0A747970652053656C6563745363656E6172696F43686F69636552657175657374203D207265636F7264207B63686F6963653A20537461676543686F6963654B696E643B7D3B0A747970652053656C6563745363656E6172696F43686F6963654572726F72203D200A2076617269616E74207B0A20202067616D654E6F744163746976653B0A20202067616D654E6F74466F756E643B0A202020696E76616C696443686F6963653A20746578743B0A202020696E76616C69645461726765743B0A2020206E6F745363656E6172696F5475726E3B0A20202074617267657452657175697265643B0A207D3B0A74797065205363656E6172696F5374616765526573756C744B696E64203D200A2076617269616E74207B0A20202063686F6963653A205363656E6172696F43686F696365526573756C743B0A202020636F6D6261743A205363656E6172696F436F6D626174526573756C743B0A2020207265776172643A205363656E6172696F526577617264526573756C743B0A207D3B0A74797065205363656E6172696F5374616765526573756C74203D200A207265636F7264207B0A202020656666656374733A20766563204F7574636F6D654566666563743B0A2020206B696E643A205363656E6172696F5374616765526573756C744B696E643B0A207D3B0A74797065205363656E6172696F53746167654B696E64203D200A2076617269616E74207B0A20202063686F6963653A2043686F6963655363656E6172696F53746174653B0A202020636F6D6261743A20436F6D6261745363656E6172696F53746174653B0A2020207265776172643A205265776172645363656E6172696F53746174653B0A207D3B0A74797065205363656E6172696F526577617264526573756C74203D207265636F7264207B6B696E643A205265776172644B696E643B7D3B0A74797065205363656E6172696F506174684B696E64203D200A2076617269616E74207B0A20202063686F6963653A2043686F696365506174683B0A202020636F6D6261743A20436F6D626174506174683B0A2020207265776172643A20526577617264506174683B0A207D3B0A74797065205363656E6172696F50617468203D200A207265636F7264207B0A2020206465736372697074696F6E3A20746578743B0A20202069643A20746578743B0A2020206B696E643A205363656E6172696F506174684B696E643B0A207D3B0A74797065205363656E6172696F4D65746144617461203D200A207265636F7264207B0A20202063617465676F72793A205363656E6172696F43617465676F72793B0A2020206465736372697074696F6E3A20746578743B0A20202069643A20746578743B0A202020696D6167653A20506978656C496D6167653B0A2020206C6F636174696F6E3A204C6F636174696F6E4B696E643B0A2020206E616D653A20746578743B0A20202070617468733A20766563205363656E6172696F506174683B0A202020756E6C6F636B526571756972656D656E743A20556E6C6F636B526571756972656D656E743B0A207D3B0A74797065205363656E6172696F456666656374203D2076617269616E74207B6174747269627574653A204174747269627574655363656E6172696F4566666563743B7D3B0A74797065205363656E6172696F436F6D626174526573756C74203D200A207265636F7264207B0A2020206B696E643A20436F6D626174526573756C744B696E643B0A2020206C6F673A2076656320436F6D6261744C6F67456E7472793B0A207D3B0A74797065205363656E6172696F43686F696365526573756C74203D200A207265636F7264207B0A20202063686F6963653A2043686F6963653B0A2020206B696E643A2043686F696365526573756C744B696E643B0A207D3B0A74797065205363656E6172696F43617465676F7279203D200A2076617269616E74207B0A202020636F6D6261743A20436F6D6261745363656E6172696F43617465676F72793B0A202020656E636F756E7465723B0A20202073746F72653B0A207D3B0A74797065205363656E6172696F203D200A207265636F7264207B0A20202063757272656E7453746167653A205363656E6172696F53746167654B696E643B0A2020206D6574614461746149643A20746578743B0A20202070726576696F75735374616765733A20766563205363656E6172696F5374616765526573756C743B0A207D3B0A7479706520526F7574654C6F636174696F6E4B696E64203D2076617269616E74207B7363656E6172696F3B7D3B0A7479706520526F7574654C6F636174696F6E203D200A207265636F7264207B0A2020206B696E643A20526F7574654C6F636174696F6E4B696E643B0A2020207A6F6E6549643A20746578743B0A207D3B0A74797065205265776172645363656E6172696F5374617465203D200A207265636F7264207B0A2020206E657874506174683A204E657874506174684B696E643B0A2020206F7074696F6E733A207265636F7264207B0A20202020202020202020202020205265776172644B696E643B0A20202020202020202020202020205265776172644B696E643B0A20202020202020202020202020205265776172644B696E643B0A2020202020202020202020207D3B0A207D3B0A7479706520526577617264506174684B696E64203D200A2076617269616E74207B0A20202072616E646F6D3B0A20202073706563696669633A207265636F7264207B0A2020202020202020202020202020205265776172644B696E643B0A2020202020202020202020202020205265776172644B696E643B0A2020202020202020202020202020205265776172644B696E643B0A202020202020202020202020207D3B0A207D3B0A747970652052657761726450617468203D200A207265636F7264207B0A2020206B696E643A20526577617264506174684B696E643B0A2020206E657874506174683A204E657874506174684B696E643B0A207D3B0A74797065205265776172644B696E64203D200A2076617269616E74207B0A202020676F6C643A206E61743B0A2020206865616C74683A206E61743B0A2020206974656D3A20746578743B0A202020776561706F6E3A20746578743B0A207D3B0A747970652052657761726443686F696365203D200A2076617269616E74207B0A202020676F6C643A206E61743B0A2020206865616C74683A206E61743B0A2020206974656D3A204974656D52657761726443686F6963653B0A202020776561706F6E3A20746578743B0A207D3B0A7479706520526574616C696174696E67203D2076617269616E74207B666C61743A206E61743B7D3B0A74797065205265676973746572526573756C74203D200A2076617269616E74207B0A2020206572723A2052656769737465724572726F723B0A2020206F6B3A20557365723B0A207D3B0A747970652052656769737465724572726F72203D2076617269616E74207B616C72656164794D656D6265723B7D3B0A747970652052616365203D200A207265636F7264207B0A2020206465736372697074696F6E3A20746578743B0A20202069643A20746578743B0A202020696D6167653A20506978656C496D6167653B0A2020206E616D653A20746578743B0A2020207374617274696E674974656D4964733A2076656320746578743B0A2020207374617274696E67536B696C6C416374696F6E4964733A2076656320746578743B0A202020756E6C6F636B526571756972656D656E743A20556E6C6F636B526571756972656D656E743B0A207D3B0A747970652050726F706F73616C537461747573203D200A2076617269616E74207B0A20202065786563757465643A0A202020207265636F7264207B0A20202020202063686F6963653A206F707420626F6F6C3B0A202020202020657865637574656454696D653A2054696D653B0A202020202020657865637574696E6754696D653A2054696D653B0A202020207D3B0A202020657865637574696E673A207265636F7264207B0A2020202020202020202020202020202063686F6963653A206F707420626F6F6C3B0A20202020202020202020202020202020657865637574696E6754696D653A2054696D653B0A20202020202020202020202020207D3B0A2020206661696C6564546F457865637574653A0A202020207265636F7264207B0A20202020202063686F6963653A206F707420626F6F6C3B0A2020202020206572726F723A20746578743B0A202020202020657865637574696E6754696D653A2054696D653B0A2020202020206661696C656454696D653A2054696D653B0A202020207D3B0A2020206F70656E3B0A207D3B0A747970652050726F706F73616C436F6E74656E74203D200A2076617269616E74207B0A2020206D6F6469667947616D65436F6E74656E743A204D6F6469667947616D65436F6E74656E743B0A2020206D6F74696F6E3A204D6F74696F6E436F6E74656E743B0A207D3B0A7479706520506978656C496D616765203D200A207265636F7264207B0A20202070616C657474653A20766563207265636F7264207B0A2020202020202020202020202020202020206E6174383B0A2020202020202020202020202020202020206E6174383B0A2020202020202020202020202020202020206E6174383B0A202020202020202020202020202020207D3B0A202020706978656C446174613A2076656320506978656C446174613B0A207D3B0A7479706520506978656C44617461203D200A207265636F7264207B0A202020636F756E743A206E61743B0A20202070616C65747465496E6465783A206F7074206E6174383B0A207D3B0A7479706520506572696F64696354696D696E67203D200A207265636F7264207B0A20202070686173653A205475726E50686173653B0A2020207475726E4475726174696F6E3A206E61743B0A207D3B0A7479706520506572696F646963456666656374526573756C74203D200A207265636F7264207B0A202020616D6F756E743A206E61743B0A2020206B696E643A20506572696F6469634566666563744B696E643B0A20202070686173653A205475726E50686173653B0A207D3B0A7479706520506572696F6469634566666563744B696E64203D200A2076617269616E74207B0A202020626C6F636B3B0A20202064616D6167653B0A2020206865616C3B0A207D3B0A747970652050617468456666656374203D200A2076617269616E74207B0A202020616368696576656D656E743A20746578743B0A2020206164644974656D3A20746578743B0A2020206164644974656D57697468546167733A2076656320746578743B0A20202064616D6167653A204E617456616C75653B0A2020206865616C3A204E617456616C75653B0A20202072656D6F7665476F6C643A204E617456616C75653B0A20202072656D6F76654974656D3A20746578743B0A20202072656D6F76654974656D57697468546167733A2076656320746578743B0A207D3B0A74797065205061676564526573756C745F32203D200A207265636F7264207B0A202020636F756E743A206E61743B0A202020646174613A2076656320436F6D706C6574656447616D65576974684D657461446174613B0A2020206F66667365743A206E61743B0A202020746F74616C436F756E743A206E61743B0A207D3B0A74797065205061676564526573756C745F31203D200A207265636F7264207B0A202020636F756E743A206E61743B0A202020646174613A2076656320557365723B0A2020206F66667365743A206E61743B0A202020746F74616C436F756E743A206E61743B0A207D3B0A74797065205061676564526573756C74203D200A207265636F7264207B0A202020636F756E743A206E61743B0A202020646174613A2076656320576F726C6450726F706F73616C3B0A2020206F66667365743A206E61743B0A202020746F74616C436F756E743A206E61743B0A207D3B0A74797065204F7574636F6D65456666656374203D200A2076617269616E74207B0A2020206164644974656D3A204164644974656D4F7574636F6D654566666563743B0A202020676F6C6444656C74613A20696E743B0A2020206865616C746844656C74613A20696E743B0A2020206D61784865616C746844656C74613A20696E743B0A20202072656D6F76654974656D3A20746578743B0A20202073776170576561706F6E3A2053776170576561706F6E4F7574636F6D654566666563743B0A2020202274657874223A20746578743B0A207D3B0A74797065204F7074696F6E576569676874203D200A207265636F7264207B0A2020206B696E643A205765696768744B696E643B0A20202076616C75653A20666C6F617436343B0A207D3B0A74797065204E657874506174684B696E64203D200A2076617269616E74207B0A2020206D756C74693A207665632057656967687465645363656E6172696F506174684F7074696F6E3B0A2020206E6F6E653B0A20202073696E676C653A20746578743B0A207D3B0A74797065204E617456616C7565203D200A2076617269616E74207B0A20202072616E646F6D3A207265636F7264207B0A202020202020202020202020206E61743B0A202020202020202020202020206E61743B0A20202020202020202020207D3B0A2020207261773A206E61743B0A207D3B0A74797065204D6F74696F6E436F6E74656E74203D200A207265636F7264207B0A2020206465736372697074696F6E3A20746578743B0A2020207469746C653A20746578743B0A207D3B0A74797065204D6F6469667947616D65436F6E74656E74203D200A2076617269616E74207B0A202020616368696576656D656E743A20416368696576656D656E743B0A202020616374696F6E3A20416374696F6E3B0A202020636C6173733A20436C6173733B0A20202063726561747572653A2043726561747572653B0A2020206974656D3A204974656D3B0A202020726163653A20526163653B0A2020207363656E6172696F3A205363656E6172696F4D657461446174613B0A202020776561706F6E3A20576561706F6E3B0A2020207A6F6E653A205A6F6E653B0A207D3B0A74797065204C6F636174696F6E4B696E64203D200A2076617269616E74207B0A202020636F6D6D6F6E3B0A2020207A6F6E654964733A2076656320746578743B0A207D3B0A74797065204974656D52657761726443686F696365203D200A207265636F7264207B0A20202069643A20746578743B0A202020696E76656E746F7279536C6F743A206E61743B0A207D3B0A74797065204974656D203D200A207265636F7264207B0A202020616374696F6E4964733A2076656320746578743B0A2020206465736372697074696F6E3A20746578743B0A20202069643A20746578743B0A202020696D6167653A20506978656C496D6167653B0A2020206E616D653A20746578743B0A202020746167733A2076656320746578743B0A202020756E6C6F636B526571756972656D656E743A20556E6C6F636B526571756972656D656E743B0A207D3B0A7479706520496E76656E746F7279536C6F74576974684D65746144617461203D207265636F7264207B6974656D3A206F7074204974656D3B7D3B0A7479706520496E50726F6772657373526F7574654C6F636174696F6E4B696E64203D2076617269616E74207B7363656E6172696F3A205363656E6172696F3B7D3B0A7479706520496E50726F677265737347616D655374617465576974684D65746144617461203D200A207265636F7264207B0A2020206368617261637465723A20436861726163746572576974684D657461446174613B0A202020636F6D706C657465644C6F636174696F6E733A2076656320436F6D706C65746564526F7574654C6F636174696F6E4B696E643B0A20202063757272656E744C6F636174696F6E3A20496E50726F6772657373526F7574654C6F636174696F6E4B696E643B0A202020726F7574653A2076656320526F7574654C6F636174696F6E3B0A207D3B0A74797065204865616C4C6F67456E747279203D200A207265636F7264207B0A202020616D6F756E743A206E61743B0A202020736F757263653A205461726765744B696E643B0A2020207461726765743A205461726765744B696E643B0A207D3B0A74797065204865616C203D200A207265636F7264207B0A2020206D61783A206E61743B0A2020206D696E3A206E61743B0A20202074696D696E673A20416374696F6E54696D696E674B696E643B0A207D3B0A7479706520476574576F726C6450726F706F73616C526573756C74203D200A2076617269616E74207B0A2020206572723A20476574576F726C6450726F706F73616C4572726F723B0A2020206F6B3A20576F726C6450726F706F73616C3B0A207D3B0A7479706520476574576F726C6450726F706F73616C4572726F72203D2076617269616E74207B70726F706F73616C4E6F74466F756E643B7D3B0A74797065204765745573657273526573756C74203D2076617269616E74207B6F6B3A2076656320557365723B7D3B0A7479706520476574557365727352657175657374203D2076617269616E74207B616C6C3B7D3B0A7479706520476574557365725374617473526573756C74203D200A2076617269616E74207B0A2020206572723B0A2020206F6B3A205573657253746174733B0A207D3B0A747970652047657455736572526573756C74203D200A2076617269616E74207B0A2020206572723A20476574557365724572726F723B0A2020206F6B3A20557365723B0A207D3B0A7479706520476574557365724572726F72203D2076617269616E74207B6E6F74466F756E643B7D3B0A7479706520476574546F705573657273526573756C74203D2076617269616E74207B6F6B3A205061676564526573756C745F313B7D3B0A7479706520476574546F70557365727352657175657374203D200A207265636F7264207B0A202020636F756E743A206E61743B0A2020206F66667365743A206E61743B0A207D3B0A747970652047657443757272656E7447616D65526573756C74203D200A2076617269616E74207B0A2020206572723A2076617269616E74207B6E6F7441757468656E746963617465643B7D3B0A2020206F6B3A206F70742047616D65576974684D657461446174613B0A207D3B0A7479706520476574436F6D706C6574656447616D657352657175657374203D200A207265636F7264207B0A202020636F756E743A206E61743B0A2020206F66667365743A206E61743B0A207D3B0A747970652047616D65576974684D65746144617461203D200A207265636F7264207B0A20202069643A206E61743B0A202020706C6179657249643A207072696E636970616C3B0A202020737461727454696D653A2054696D653B0A20202073746174653A2047616D655374617465576974684D657461446174613B0A207D3B0A747970652047616D655374617465576974684D65746144617461203D200A2076617269616E74207B0A202020636F6D706C657465643A20436F6D706C6574656447616D655374617465576974684D657461446174613B0A202020696E50726F67726573733A20496E50726F677265737347616D655374617465576974684D657461446174613B0A2020207374617274696E673A205374617274696E6747616D655374617465576974684D657461446174613B0A207D3B0A7479706520466F726665697447616D654F7574636F6D65576974684D65746144617461203D207265636F7264207B0A202020202020202020202020202020202020202020202020202020202020202020202020202020206368617261637465723A206F707420436861726163746572576974684D657461446174613B0A20202020202020202020202020202020202020202020202020202020202020202020202020207D3B0A7479706520446561746847616D654F7574636F6D65576974684D65746144617461203D207265636F7264207B6368617261637465723A20436861726163746572576974684D657461446174613B0A2020202020202020202020202020202020202020202020202020202020202020202020207D3B0A747970652044616D6167654C6F67456E747279203D200A207265636F7264207B0A202020616D6F756E743A206E61743B0A202020736F757263653A205461726765744B696E643B0A2020207461726765743A205461726765744B696E643B0A207D3B0A747970652044616D616765203D200A207265636F7264207B0A2020206D61783A206E61743B0A2020206D696E3A206E61743B0A20202074696D696E673A20416374696F6E54696D696E674B696E643B0A207D3B0A747970652043726561747572654C6F636174696F6E4B696E64203D200A2076617269616E74207B0A202020636F6D6D6F6E3B0A2020207A6F6E654964733A2076656320746578743B0A207D3B0A747970652043726561747572654B696E64203D200A2076617269616E74207B0A202020626F73733B0A202020656C6974653B0A2020206E6F726D616C3B0A207D3B0A74797065204372656174757265436F6D6261745374617465203D200A207265636F7264207B0A202020616374696F6E4964733A2076656320746578743B0A202020626C6F636B3A206E61743B0A202020637265617475726549643A20746578743B0A2020206865616C74683A206E61743B0A2020206D61784865616C74683A206E61743B0A202020737461747573456666656374733A2076656320537461747573456666656374526573756C743B0A207D3B0A74797065204372656174757265203D200A207265636F7264207B0A202020616374696F6E4964733A2076656320746578743B0A2020206465736372697074696F6E3A20746578743B0A2020206865616C74683A206E61743B0A20202069643A20746578743B0A2020206B696E643A2043726561747572654B696E643B0A2020206C6F636174696F6E3A2043726561747572654C6F636174696F6E4B696E643B0A2020206D61784865616C74683A206E61743B0A2020206E616D653A20746578743B0A202020756E6C6F636B526571756972656D656E743A20556E6C6F636B526571756972656D656E743B0A207D3B0A7479706520437265617465576F726C6450726F706F73616C526573756C74203D200A2076617269616E74207B0A2020206572723A20437265617465576F726C6450726F706F73616C4572726F723B0A2020206F6B3A206E61743B0A207D3B0A7479706520437265617465576F726C6450726F706F73616C52657175657374203D200A2076617269616E74207B0A2020206D6F6469667947616D65436F6E74656E743A204D6F6469667947616D65436F6E74656E743B0A2020206D6F74696F6E3A204D6F74696F6E436F6E74656E743B0A207D3B0A7479706520437265617465576F726C6450726F706F73616C4572726F72203D200A2076617269616E74207B0A202020696E76616C69643A2076656320746578743B0A2020206E6F74456C696769626C653B0A207D3B0A747970652043726561746547616D65526573756C74203D200A2076617269616E74207B0A2020206572723A2043726561746547616D654572726F723B0A2020206F6B3B0A207D3B0A747970652043726561746547616D6552657175657374203D207265636F7264207B7D3B0A747970652043726561746547616D654572726F72203D200A2076617269616E74207B0A202020616C7265616479496E697469616C697A65643B0A2020206E6F436C61737365733B0A2020206E6F4372656174757265733B0A2020206E6F437265617475726573466F725A6F6E653A20746578743B0A2020206E6F4974656D733B0A2020206E6F52616365733B0A2020206E6F5363656E6172696F733B0A2020206E6F5363656E6172696F73466F725A6F6E653A20746578743B0A2020206E6F576561706F6E733B0A2020206E6F5A6F6E65733B0A2020206E6F7441757468656E746963617465643B0A202020757365724E6F74526567697374657265643B0A207D3B0A7479706520436F6D706C657465645363656E6172696F203D200A207265636F7264207B0A2020206D6574614461746149643A20746578743B0A2020207374616765733A20766563205363656E6172696F5374616765526573756C743B0A207D3B0A7479706520436F6D706C65746564526F7574654C6F636174696F6E4B696E64203D2076617269616E74207B7363656E6172696F3A20436F6D706C657465645363656E6172696F3B7D3B0A7479706520436F6D706C6574656447616D65576974684D65746144617461203D200A207265636F7264207B0A202020656E6454696D653A2054696D653B0A20202069643A206E61743B0A2020206F7574636F6D653A20436F6D706C6574656447616D654F7574636F6D65576974684D657461446174613B0A202020706C6179657249643A207072696E636970616C3B0A202020726F7574653A2076656320436F6D706C6574656447616D65526F7574654C6F636174696F6E3B0A202020737461727454696D653A2054696D653B0A207D3B0A7479706520436F6D706C6574656447616D655374617465576974684D65746144617461203D200A207265636F7264207B0A202020656E6454696D653A2054696D653B0A2020206F7574636F6D653A20436F6D706C6574656447616D654F7574636F6D65576974684D657461446174613B0A202020726F7574653A2076656320436F6D706C6574656447616D65526F7574654C6F636174696F6E3B0A207D3B0A7479706520436F6D706C6574656447616D65526F7574654C6F636174696F6E4B696E64203D200A2076617269616E74207B0A2020206E6F74537461727465643A20526F7574654C6F636174696F6E4B696E643B0A2020207363656E6172696F3A20436F6D706C657465645363656E6172696F3B0A207D3B0A7479706520436F6D706C6574656447616D65526F7574654C6F636174696F6E203D200A207265636F7264207B0A2020206B696E643A20436F6D706C6574656447616D65526F7574654C6F636174696F6E4B696E643B0A2020207A6F6E6549643A20746578743B0A207D3B0A7479706520436F6D706C6574656447616D654F7574636F6D65576974684D65746144617461203D200A2076617269616E74207B0A20202064656174683A20446561746847616D654F7574636F6D65576974684D657461446174613B0A202020666F72666569743A20466F726665697447616D654F7574636F6D65576974684D657461446174613B0A202020766963746F72793A20566963746F727947616D654F7574636F6D65576974684D657461446174613B0A207D3B0A7479706520436F6D626174566963746F7279526573756C74203D207265636F7264207B6368617261637465724865616C74683A206E61743B7D3B0A7479706520436F6D6261745363656E6172696F5374617465203D200A207265636F7264207B0A2020206368617261637465723A20436861726163746572436F6D62617453746174653B0A2020206372656174757265733A20766563204372656174757265436F6D62617453746174653B0A2020206E657874506174683A204E657874506174684B696E643B0A207D3B0A7479706520436F6D6261745363656E6172696F43617465676F7279203D200A2076617269616E74207B0A202020626F73733B0A202020656C6974653B0A2020206E6F726D616C3B0A207D3B0A7479706520436F6D626174526573756C744B696E64203D200A2076617269616E74207B0A2020206465666561743A20436F6D626174446566656174526573756C743B0A202020696E50726F67726573733A20436F6D6261745363656E6172696F53746174653B0A202020766963746F72793A20436F6D626174566963746F7279526573756C743B0A207D3B0A7479706520436F6D62617450617468203D200A207265636F7264207B0A2020206372656174757265733A2076656320436F6D62617443726561747572654B696E643B0A2020206E657874506174683A204E657874506174684B696E643B0A207D3B0A7479706520436F6D6261744C6F67456E747279203D200A2076617269616E74207B0A202020626C6F636B3A20426C6F636B4C6F67456E7472793B0A20202064616D6167653A2044616D6167654C6F67456E7472793B0A2020206865616C3A204865616C4C6F67456E7472793B0A2020207374617475734566666563743A205374617475734566666563744C6F67456E7472793B0A207D3B0A7479706520436F6D626174456666656374546172676574203D200A2076617269616E74207B0A20202073656C663B0A202020746172676574733B0A207D3B0A7479706520436F6D6261744566666563744B696E64203D200A2076617269616E74207B0A2020206164645374617475734566666563743A205374617475734566666563743B0A202020626C6F636B3A20426C6F636B3B0A20202064616D6167653A2044616D6167653B0A2020206865616C3A204865616C3B0A207D3B0A7479706520436F6D626174456666656374203D200A207265636F7264207B0A2020206B696E643A20436F6D6261744566666563744B696E643B0A2020207461726765743A20436F6D6261744566666563745461726765743B0A207D3B0A7479706520436F6D626174446566656174526573756C74203D207265636F7264207B6372656174757265733A20766563204372656174757265436F6D62617453746174653B7D3B0A7479706520436F6D62617443726561747572654C6F636174696F6E46696C746572203D200A2076617269616E74207B0A202020616E793B0A202020636F6D6D6F6E3B0A2020207A6F6E653A20746578743B0A207D3B0A7479706520436F6D62617443726561747572654B696E64203D200A2076617269616E74207B0A20202066696C7465723A20436F6D626174437265617475726546696C7465723B0A20202069643A20746578743B0A207D3B0A7479706520436F6D626174437265617475726546696C746572203D207265636F7264207B6C6F636174696F6E3A20436F6D62617443726561747572654C6F636174696F6E46696C7465723B7D3B0A7479706520436F6D62617443686F696365203D200A207265636F7264207B0A2020206B696E643A20436861726163746572416374696F6E4B696E643B0A2020207461726765743A206F707420416374696F6E546172676574526573756C743B0A207D3B0A7479706520436C617373203D200A207265636F7264207B0A2020206465736372697074696F6E3A20746578743B0A20202069643A20746578743B0A202020696D6167653A20506978656C496D6167653B0A2020206E616D653A20746578743B0A2020207374617274696E674974656D4964733A2076656320746578743B0A2020207374617274696E67536B696C6C416374696F6E4964733A2076656320746578743B0A202020756E6C6F636B526571756972656D656E743A20556E6C6F636B526571756972656D656E743B0A202020776561706F6E49643A20746578743B0A207D3B0A747970652043686F6963655363656E6172696F5374617465203D207265636F7264207B63686F696365733A207665632043686F6963653B7D3B0A747970652043686F696365526573756C744B696E64203D200A2076617269616E74207B0A202020636F6D706C6574653B0A20202064656174683B0A207D3B0A747970652043686F696365526571756972656D656E74203D200A2076617269616E74207B0A2020206174747269627574653A2041747472696275746543686F696365526571756972656D656E743B0A202020676F6C643A206E61743B0A2020206974656D57697468546167733A2076656320746578743B0A207D3B0A747970652043686F69636550617468203D207265636F7264207B63686F696365733A207665632043686F6963653B7D3B0A747970652043686F696365203D200A207265636F7264207B0A2020206465736372697074696F6E3A20746578743B0A202020656666656374733A2076656320506174684566666563743B0A20202069643A20746578743B0A2020206E657874506174683A204E657874506174684B696E643B0A202020726571756972656D656E743A206F70742043686F696365526571756972656D656E743B0A207D3B0A7479706520436861726163746572576974684D65746144617461203D200A207265636F7264207B0A202020616374696F6E733A2076656320436861726163746572416374696F6E576974684D657461446174613B0A202020617474726962757465733A20436861726163746572417474726962757465733B0A202020636C6173733A20436C6173733B0A202020676F6C643A206E61743B0A2020206865616C74683A206E61743B0A202020696E76656E746F7279536C6F74733A2076656320496E76656E746F7279536C6F74576974684D657461446174613B0A2020206D61784865616C74683A206E61743B0A202020726163653A20526163653B0A202020776561706F6E3A20576561706F6E3B0A207D3B0A7479706520436861726163746572436F6D6261745374617465203D200A207265636F7264207B0A202020626C6F636B3A206E61743B0A2020206865616C74683A206E61743B0A2020206974656D416374696F6E49643A206F707420746578743B0A2020206D61784865616C74683A206E61743B0A202020736B696C6C416374696F6E49643A206F707420746578743B0A202020737461747573456666656374733A2076656320537461747573456666656374526573756C743B0A202020776561706F6E416374696F6E49643A206F707420746578743B0A207D3B0A747970652043686172616374657241747472696275746573203D200A207265636F7264207B0A2020206368617269736D613A20696E743B0A2020206465787465726974793A20696E743B0A202020737472656E6774683A20696E743B0A202020776973646F6D3A20696E743B0A207D3B0A7479706520436861726163746572416374696F6E576974684D65746144617461203D200A207265636F7264207B0A202020616374696F6E3A20416374696F6E3B0A2020206B696E643A20436861726163746572416374696F6E4B696E643B0A207D3B0A7479706520436861726163746572416374696F6E4B696E64203D200A2076617269616E74207B0A2020206974656D3B0A202020736B696C6C3B0A202020776561706F6E3B0A207D3B0A7479706520426C6F636B4C6F67456E747279203D200A207265636F7264207B0A202020616D6F756E743A206E61743B0A202020736F757263653A205461726765744B696E643B0A2020207461726765743A205461726765744B696E643B0A207D3B0A7479706520426C6F636B203D200A207265636F7264207B0A2020206D61783A206E61743B0A2020206D696E3A206E61743B0A20202074696D696E673A20416374696F6E54696D696E674B696E643B0A207D3B0A74797065204174747269627574655363656E6172696F456666656374203D200A207265636F7264207B0A2020206174747269627574653A204174747269627574653B0A20202076616C75653A20696E743B0A207D3B0A747970652041747472696275746543686F696365526571756972656D656E74203D200A207265636F7264207B0A2020206174747269627574653A204174747269627574653B0A20202076616C75653A20696E743B0A207D3B0A7479706520417474726962757465203D200A2076617269616E74207B0A2020206368617269736D613B0A2020206465787465726974793B0A202020737472656E6774683B0A202020776973646F6D3B0A207D3B0A74797065204164644974656D4F7574636F6D65456666656374203D200A207265636F7264207B0A2020206974656D49643A20746578743B0A20202072656D6F7665644974656D49643A206F707420746578743B0A207D3B0A7479706520416374696F6E54696D696E674B696E64203D200A2076617269616E74207B0A202020696D6D6564696174653B0A202020706572696F6469633A20506572696F64696354696D696E673B0A207D3B0A7479706520416374696F6E54617267657453656C656374696F6E203D200A2076617269616E74207B0A202020616C6C3B0A20202063686F73656E3B0A20202072616E646F6D3A207265636F7264207B636F756E743A206E61743B7D3B0A207D3B0A7479706520416374696F6E54617267657453636F7065203D200A2076617269616E74207B0A202020616C6C793B0A202020616E793B0A202020656E656D793B0A207D3B0A7479706520416374696F6E546172676574526573756C74203D200A2076617269616E74207B0A2020206368617261637465723B0A20202063726561747572653A206E61743B0A207D3B0A7479706520416374696F6E546172676574203D200A207265636F7264207B0A20202073636F70653A20416374696F6E54617267657453636F70653B0A20202073656C656374696F6E3A20416374696F6E54617267657453656C656374696F6E3B0A207D3B0A7479706520416374696F6E203D200A207265636F7264207B0A202020636F6D626174456666656374733A2076656320436F6D6261744566666563743B0A2020206465736372697074696F6E3A20746578743B0A20202069643A20746578743B0A2020206E616D653A20746578743B0A2020207363656E6172696F456666656374733A20766563205363656E6172696F4566666563743B0A2020207461726765743A20416374696F6E5461726765743B0A207D3B0A7479706520416368696576656D656E74203D200A207265636F7264207B0A2020206465736372697074696F6E3A20746578743B0A20202069643A20746578743B0A2020206E616D653A20746578743B0A207D3B0A74797065204162616E646F6E47616D65526573756C74203D200A2076617269616E74207B0A2020206572723A2076617269616E74207B6E6F41637469766547616D653B7D3B0A2020206F6B3B0A207D3B0A73657276696365203A207B0A20206162616E646F6E47616D653A202829202D3E20284162616E646F6E47616D65526573756C74293B0A202063726561746547616D653A202843726561746547616D655265717565737429202D3E202843726561746547616D65526573756C74293B0A2020637265617465576F726C6450726F706F73616C3A2028437265617465576F726C6450726F706F73616C5265717565737429202D3E0A20202028437265617465576F726C6450726F706F73616C526573756C74293B0A2020676574416368696576656D656E74733A202829202D3E202876656320416368696576656D656E74292071756572793B0A2020676574416374696F6E733A202829202D3E202876656320416374696F6E292071756572793B0A2020676574436C61737365733A202829202D3E202876656320436C617373292071756572793B0A2020676574436F6D706C6574656447616D65733A2028476574436F6D706C6574656447616D65735265717565737429202D3E20285061676564526573756C745F32292071756572793B0A20206765744372656174757265733A202829202D3E2028766563204372656174757265292071756572793B0A202067657443757272656E7447616D653A202829202D3E202847657443757272656E7447616D65526573756C74292071756572793B0A20206765744974656D733A202829202D3E2028766563204974656D292071756572793B0A202067657452616365733A202829202D3E20287665632052616365292071756572793B0A20206765745363656E6172696F4D657461446174614C6973743A202829202D3E2028766563205363656E6172696F4D65746144617461292071756572793B0A2020676574546F7055736572733A2028476574546F7055736572735265717565737429202D3E2028476574546F705573657273526573756C74292071756572793B0A2020676574557365723A20287072696E636970616C29202D3E202847657455736572526573756C74292071756572793B0A20206765745573657253746174733A202829202D3E2028476574557365725374617473526573756C74292071756572793B0A202067657455736572733A202847657455736572735265717565737429202D3E20284765745573657273526573756C74292071756572793B0A2020676574576561706F6E733A202829202D3E202876656320576561706F6E292071756572793B0A2020676574576F726C6450726F706F73616C3A20286E617429202D3E2028476574576F726C6450726F706F73616C526573756C74292071756572793B0A2020676574576F726C6450726F706F73616C733A20286E61742C206E617429202D3E20285061676564526573756C74292071756572793B0A20206765745A6F6E65733A202829202D3E2028766563205A6F6E65292071756572793B0A202072656769737465723A202829202D3E20285265676973746572526573756C74293B0A202073656C6563745363656E6172696F43686F6963653A202853656C6563745363656E6172696F43686F6963655265717565737429202D3E0A2020202853656C6563745363656E6172696F43686F696365526573756C74293B0A2020737461727447616D653A2028537461727447616D655265717565737429202D3E2028537461727447616D65526573756C74293B0A2020766F74654F6E576F726C6450726F706F73616C3A2028566F74654F6E576F726C6450726F706F73616C5265717565737429202D3E0A20202028566F74654F6E576F726C6450726F706F73616C526573756C74293B0A7D0A8204582087FDA0FB2A045F48A62181613D2122A8569F2962B506D3BFED788F5D311A4AEF82045820FAF863998F27206BD4DB9F061EC3DEFE7AE468A81C2B6BC61D4A2F03CBC267AB820458209EDF884A5D50509DD18C30E09A9A55B88AFE12457F4508EE5755FF4A17F969CF82045820CDF0A6C05B74AC41336CE2FE73ABE8BE3EE870E8894EDD6EF38BADAAD96275488204582018752817CA82FCD8EF4FD2462A013A1CFBEE9CE3215E0777E8F96AD64B46453282045820E8D2528773390A64B93EC05AC76795468BC808E5328C43FFD6DA228957004A8382045820A70A22DCF34B8D717AE80D694E9131C1DB726E173688118F842BBCADBE030E5C820458204DBFD19923C3AA0355DF0891D9403BB246B90623199834397A9752F1328FAD3E820458206CBA74F259AC6CF21B10DFD9ACCF4A2AC410A20CCBB74DE15A5061C032831F2B820458204A548D0DB1D48F6651ED20299FCF4C740B14DF3B19706A0282BB0B9C666BC960820458203FD0C9AD83F5B4B01CE7550A0E75FDEC15DF82B3F29B5D5286013BC246C93595820458201C2341C43046B56EA6D03BCAFAB4B440C094477258DD6BA0C82D4111B4FD98A4830182045820898FA765A188D161A3E3057DF3017DCFA386D0B8A7A99C6BAE6FD765315DAADA83024474696D65820349AAC7FE98E8E4809718697369676E61747572655830810FB38F08F0DD42843E98CA8ED8FB974FC8552BFA38B8674F2F8C2EBDAE35E936AEDF694EEEE8073C308A63F7DF0F8D6A64656C65676174696F6EA2697375626E65745F6964581D12790E7661FCCD3D4FC83138DCAFFD9F188E867B45AE10C8836DD0B8026B636572746966696361746559027DD9D9F7A2647472656583018204582010B2306F17FE9FB46372B81FAB1254A9F00308C4E70DFEE8B7065F3BCF0783FB8301830182045820CCD98C76B7A404042F0D5189CFB02D006D041299AD834CC490FA220E10317F458302467375626E65748301830183018301830182045820D1D38FFCAEFC49B6417EF6F5F39B4BAE46280F55F4F5D8BE681BD480083E8897830182045820051E96B350B6E2B39063D9D735FD9A6F13AA672FB140E3A6E7D8A095BF5AE0B08302581D12790E7661FCCD3D4FC83138DCAFFD9F188E867B45AE10C8836DD0B802830183024F63616E69737465725F72616E6765738203581BD9D9F781824A000000000150000001014A00000000015FFFFF010183024A7075626C69635F6B657982035885308182301D060D2B0601040182DC7C0503010201060C2B0601040182DC7C0503020103610086D88EBBD2F1663E65D3A3FF07E8EE9FA420D08B9A6822919F224B8B802D5D9BE150DC493F84C23E73A0CC1D2C2EE28709FF140000128FCD5DFBD7B457EF3AF344766D7FF0924FE7A7F456DED77CA6DE3B1B406B710C4EAED7287AB9A35276698204582052A3D0680479A713A022877C63B5B0AFFEDF60D10A2E2BA29AFC207EB5E92F248204582088FEA0DB69F38F9CF3FBA88F8A040F3CADC9AE7772FA1A406A6EA464FA858B9E820458206961EF137C2AEE0B0467082EF6D3C12C03E93013B602A4CB6214270E484863F18204582051A4F98FADBC89C3808F82BC45232C0DCFD454944619552F02E4457F4D8940A083024474696D65820349A083E5A8A4F1999618697369676E6174757265583085FE308F26E69B1CF5EE5215534A79B21F3BA78D192CBFD83A6885E9C76F10E2D44F34948B2E32D1D31E825A1FC6FB5C"); + + // httpClientMock.Setup(c => c.PostAsync( + // It.Is(url => url.Contains("/api/v2/canister/") && url.Contains("/read_state")), + // It.IsAny(), + // It.IsAny())) + // .ReturnsAsync(CreateHttpResponse(HttpStatusCode.OK, readStateResponseBytes)); + + // // Act + // var result = await agent.CallAsync(signedContent); + + // // Assert + // Assert.NotNull(result); + // Assert.Equal("hello", result.ToObjects()); + //} + + //[Fact] + //public async Task CallAsync_RejectedResponse_ThrowsCallRejectedException() + //{ + // // Arrange + // Mock httpClientMock = new(); + // HttpAgent agent = new(httpClientMock.Object, skipCertificateValidation: true); + + // Principal sender = identity.GetPrincipal(); + // ICTimestamp ingressExpiry = ICTimestamp.Future(TimeSpan.FromMinutes(1)); + // CallRequest request = new(canisterId, "greet", CandidArg.FromCandid(), sender, ingressExpiry); + // var signedContent = identity.Sign(request); + + + // byte[] responseBytes = []; + // HttpResponse httpResponse = CreateHttpResponse(HttpStatusCode.OK, responseBytes); + + // httpClientMock.Setup(c => c.PostAsync( + // It.Is(url => url.Contains("/api/v3/canister/")), + // It.IsAny(), + // It.IsAny())) + // .ReturnsAsync(httpResponse); + + // // Act & Assert + // var exception = await Assert.ThrowsAsync( + // async () => await agent.CallAsync(signedContent)); + + // Assert.Equal(RejectCode.CanisterError, exception.RejectCode); + // Assert.Equal("Test error message", exception.Message); + // Assert.Equal("TEST_ERROR", exception.ErrorCode); + //} + + //[Fact] + //public async Task QueryAsync_SuccessfulResponse_ReturnsReply() + //{ + // // Arrange + // Mock httpClientMock = new(); + // HttpAgent agent = new(httpClientMock.Object); + + // Principal sender = identity.GetPrincipal(); + // ICTimestamp ingressExpiry = ICTimestamp.Future(TimeSpan.FromMinutes(1)); + // QueryRequest request = new(canisterId, "greet", CandidArg.FromCandid(), sender, ingressExpiry); + // var signedContent = identity.Sign(request); + + + // byte[] responseBytes = []; + // HttpResponse httpResponse = CreateHttpResponse(HttpStatusCode.OK, responseBytes); + + // httpClientMock.Setup(c => c.PostAsync( + // It.Is(url => url.Contains("/api/v2/canister/") && url.Contains("/query")), + // It.IsAny(), + // It.IsAny())) + // .ReturnsAsync(httpResponse); + + // // Act + // var result = await agent.QueryAsync(signedContent); + + // // Assert + // Assert.NotNull(result); + // Assert.Equal("hello", result.ToObjects()); + //} + + //[Fact] + //public async Task QueryAsync_RejectedResponse_ThrowsCallRejectedException() + //{ + // // Arrange + // Mock httpClientMock = new(); + // HttpAgent agent = new(httpClientMock.Object); + + // Principal sender = identity.GetPrincipal(); + // ICTimestamp ingressExpiry = ICTimestamp.Future(TimeSpan.FromMinutes(1)); + + // QueryRequest request = new(canisterId, "greet", CandidArg.FromCandid(), sender, ingressExpiry); + // SignedRequest signedContent = identity.Sign(request); + + // byte[] responseBytes = []; + // HttpResponse httpResponse = CreateHttpResponse(HttpStatusCode.OK, responseBytes); + + // httpClientMock.Setup(c => c.PostAsync( + // It.Is(url => url.Contains("/api/v2/canister/") && url.Contains("/query")), + // It.IsAny(), + // It.IsAny())) + // .ReturnsAsync(httpResponse); + + // // Act & Assert + // var exception = await Assert.ThrowsAsync( + // async () => await agent.QueryAsync(signedContent)); + + // Assert.Equal(RejectCode.CanisterError, exception.RejectCode); + // Assert.Equal("Test error message", exception.Message); + // Assert.Equal("TEST_ERROR", exception.ErrorCode); + //} + + //[Fact] + //public async Task ReadStateAsync_SuccessfulResponse_ReturnsCertificate() + //{ + // // Arrange + // Mock httpClientMock = new(); + // HttpAgent agent = new(httpClientMock.Object, skipCertificateValidation: true); + + // RequestId requestId = RequestId.FromBytes(new byte[32]); + + // Principal sender = identity.GetPrincipal(); + // ICTimestamp ingressExpiry = ICTimestamp.Future(TimeSpan.FromMinutes(1)); + // List paths = [ + // StatePath.FromSegments("request_status", requestId.RawValue) + // ]; + // ReadStateRequest request = new(paths, sender, ingressExpiry); + // var signedContent = identity.Sign(request); + + // byte[] responseBytes = []; + + // HttpResponse httpResponse = CreateHttpResponse(HttpStatusCode.OK, responseBytes); + + // httpClientMock.Setup(c => c.PostAsync( + // It.Is(url => url.Contains("/api/v2/canister/") && url.Contains("/read_state")), + // It.IsAny(), + // It.IsAny())) + // .ReturnsAsync(httpResponse); + + // // Act + // var result = await agent.ReadStateAsync(canisterId, signedContent); + + // // Assert + // Assert.NotNull(result); + // Assert.NotNull(result.Certificate); + + // RequestStatus? requestStatus = IAgentExtensions.ParseRequestStatus( + // result.Certificate.Tree.GetValueOrDefault(StatePath.FromSegments("request_status", requestId.RawValue)) + // ); + + // Assert.Equal(RequestStatus.StatusType.Replied, requestStatus?.Type); + // Assert.Equal("hello", requestStatus?.AsReplied().ToObjects()); + //} + + //[Fact] + //public async Task GetRootKeyAsync_StatusResponse_ReturnsRootKey() + //{ + // // Arrange + // Mock httpClientMock = new(); + // HttpAgent agent = new(httpClientMock.Object); + + // // Mock status response with development root key + // byte[] rootKeyBytes = new byte[] { 0x30, 0x82, 0x01, 0x22, 0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x01, 0x05, 0x00 }; + + + // byte[] responseBytes = []; + // HttpResponse httpResponse = CreateHttpResponse(HttpStatusCode.OK, responseBytes); + + // httpClientMock.Setup(c => c.GetAsync( + // It.Is(url => url.Contains("/api/v2/status")), + // It.IsAny())) + // .ReturnsAsync(httpResponse); + + // // Act + // SubjectPublicKeyInfo result = await agent.GetRootKeyAsync(); + + // // Assert + // Assert.NotNull(result); + // // Compare DER encodings + // Assert.Equal(rootKeyBytes, result.ToDerEncoding()); + //} + + //[Fact] + //public async Task GetRootKeyAsync_NoDevRootKey_ReturnsMainNetKey() + //{ + // // Arrange + // Mock httpClientMock = new(); + // HttpAgent agent = new(httpClientMock.Object); + + // // Mock status response without development root key + // StatusResponse statusResponse = new( + // icApiVersion: null, + // implementationSource: null, + // implementationVersion: null, + // implementationRevision: null, + // developmentRootKey: null + // ); + + // byte[] responseBytes = []; + // HttpResponse httpResponse = CreateHttpResponse(HttpStatusCode.OK, responseBytes); + + // httpClientMock.Setup(c => c.GetAsync( + // It.Is(url => url.Contains("/api/v2/status")), + // It.IsAny())) + // .ReturnsAsync(httpResponse); + + // // Act + // SubjectPublicKeyInfo result = await agent.GetRootKeyAsync(); + + // // Assert + // Assert.NotNull(result); + // // Should be main net key + // Assert.Equal(SubjectPublicKeyInfo.MainNetRootPublicKey.ToDerEncoding(), result.ToDerEncoding()); + //} + + //[Fact] + //public async Task CallAsynchronousAsync_SuccessfulResponse_ReturnsRequestId() + //{ + // // Arrange + // Mock httpClientMock = new(); + // HttpAgent agent = new(httpClientMock.Object); + + // Principal sender = identity.GetPrincipal(); + // ICTimestamp ingressExpiry = ICTimestamp.Future(TimeSpan.FromMinutes(1)); + // CallRequest request = new(canisterId, "greet", CandidArg.FromCandid(), sender, ingressExpiry); + // var signedContent = identity.Sign(request); + // RequestId requestId = signedContent.GetOrBuildRequestId(); + + // HttpResponse httpResponse = CreateHttpResponse(HttpStatusCode.Accepted, Array.Empty()); + + // httpClientMock.Setup(c => c.PostAsync( + // It.Is(url => url.Contains("/api/v2/canister/") && url.Contains("/call")), + // It.IsAny(), + // It.IsAny())) + // .ReturnsAsync(httpResponse); + + // // Act + // var result = await agent.CallAsynchronousAsync(signedContent); + + // // Assert + // Assert.Equal(requestId, result); + //} + + //[Fact] + //public async Task CallAsynchronousAsync_RejectedResponse_ThrowsCallRejectedException() + //{ + // // Arrange + // Mock httpClientMock = new(); + // HttpAgent agent = new(httpClientMock.Object); + + // Principal sender = identity.GetPrincipal(); + // ICTimestamp ingressExpiry = ICTimestamp.Future(TimeSpan.FromMinutes(1)); + // CallRequest request = new(canisterId, "greet", CandidArg.FromCandid(), sender, ingressExpiry); + // var signedContent = identity.Sign(request); + + + // byte[] responseBytes = []; + // HttpResponse httpResponse = CreateHttpResponse(HttpStatusCode.OK, responseBytes); + + // httpClientMock.Setup(c => c.PostAsync( + // It.Is(url => url.Contains("/api/v2/canister/") && url.Contains("/call")), + // It.IsAny(), + // It.IsAny())) + // .ReturnsAsync(httpResponse); + + // // Act & Assert + // var exception = await Assert.ThrowsAsync( + // async () => await agent.CallAsynchronousAsync(signedContent)); + + // Assert.Equal(RejectCode.CanisterError, exception.RejectCode); + // Assert.Equal("Test error message", exception.Message); + // Assert.Equal("TEST_ERROR", exception.ErrorCode); + //} #region Helper Methods