diff --git a/samples/Sample.Shared/Dex/Models/CancelOrderReceipt.cs b/samples/Sample.Shared/Dex/Models/CancelOrderReceipt.cs index 74763204..70e869c6 100644 --- a/samples/Sample.Shared/Dex/Models/CancelOrderReceipt.cs +++ b/samples/Sample.Shared/Dex/Models/CancelOrderReceipt.cs @@ -1,11 +1,10 @@ using EdjCase.ICP.Candid.Mapping; using Sample.Shared.Dex.Models; -using System; using OrderId = System.UInt32; namespace Sample.Shared.Dex.Models { - [Variant(typeof(CancelOrderReceiptTag))] + [Variant()] public class CancelOrderReceipt { [VariantTagProperty()] @@ -14,6 +13,10 @@ public class CancelOrderReceipt [VariantValueProperty()] public object? Value { get; set; } + public CancelOrderErr? Err { get => this.Tag == CancelOrderReceiptTag.Err ? (CancelOrderErr)this.Value! : default; set => (this.Tag, this.Value) = (CancelOrderReceiptTag.Err, value); } + + public OrderId? Ok { get => this.Tag == CancelOrderReceiptTag.Ok ? (OrderId)this.Value! : default; set => (this.Tag, this.Value) = (CancelOrderReceiptTag.Ok, value); } + public CancelOrderReceipt(CancelOrderReceiptTag tag, object? value) { this.Tag = tag; @@ -23,43 +26,11 @@ public CancelOrderReceipt(CancelOrderReceiptTag tag, object? value) protected CancelOrderReceipt() { } - - public static CancelOrderReceipt Err(CancelOrderErr info) - { - return new CancelOrderReceipt(CancelOrderReceiptTag.Err, info); - } - - public static CancelOrderReceipt Ok(OrderId info) - { - return new CancelOrderReceipt(CancelOrderReceiptTag.Ok, info); - } - - public CancelOrderErr AsErr() - { - this.ValidateTag(CancelOrderReceiptTag.Err); - return (CancelOrderErr)this.Value!; - } - - public OrderId AsOk() - { - this.ValidateTag(CancelOrderReceiptTag.Ok); - return (OrderId)this.Value!; - } - - private void ValidateTag(CancelOrderReceiptTag tag) - { - if (!this.Tag.Equals(tag)) - { - throw new InvalidOperationException($"Cannot cast '{this.Tag}' to type '{tag}'"); - } - } } public enum CancelOrderReceiptTag { - [VariantOptionType(typeof(CancelOrderErr))] Err, - [VariantOptionType(typeof(OrderId))] Ok } } \ No newline at end of file diff --git a/samples/Sample.Shared/Dex/Models/DepositReceipt.cs b/samples/Sample.Shared/Dex/Models/DepositReceipt.cs index 10ab793d..90d93e3e 100644 --- a/samples/Sample.Shared/Dex/Models/DepositReceipt.cs +++ b/samples/Sample.Shared/Dex/Models/DepositReceipt.cs @@ -1,11 +1,10 @@ using EdjCase.ICP.Candid.Mapping; using Sample.Shared.Dex.Models; using EdjCase.ICP.Candid.Models; -using System; namespace Sample.Shared.Dex.Models { - [Variant(typeof(DepositReceiptTag))] + [Variant()] public class DepositReceipt { [VariantTagProperty()] @@ -14,6 +13,10 @@ public class DepositReceipt [VariantValueProperty()] public object? Value { get; set; } + public DepositErr? Err { get => this.Tag == DepositReceiptTag.Err ? (DepositErr)this.Value! : default; set => (this.Tag, this.Value) = (DepositReceiptTag.Err, value); } + + public UnboundedUInt? Ok { get => this.Tag == DepositReceiptTag.Ok ? (UnboundedUInt)this.Value! : default; set => (this.Tag, this.Value) = (DepositReceiptTag.Ok, value); } + public DepositReceipt(DepositReceiptTag tag, object? value) { this.Tag = tag; @@ -23,43 +26,11 @@ public DepositReceipt(DepositReceiptTag tag, object? value) protected DepositReceipt() { } - - public static DepositReceipt Err(DepositErr info) - { - return new DepositReceipt(DepositReceiptTag.Err, info); - } - - public static DepositReceipt Ok(UnboundedUInt info) - { - return new DepositReceipt(DepositReceiptTag.Ok, info); - } - - public DepositErr AsErr() - { - this.ValidateTag(DepositReceiptTag.Err); - return (DepositErr)this.Value!; - } - - public UnboundedUInt AsOk() - { - this.ValidateTag(DepositReceiptTag.Ok); - return (UnboundedUInt)this.Value!; - } - - private void ValidateTag(DepositReceiptTag tag) - { - if (!this.Tag.Equals(tag)) - { - throw new InvalidOperationException($"Cannot cast '{this.Tag}' to type '{tag}'"); - } - } } public enum DepositReceiptTag { - [VariantOptionType(typeof(DepositErr))] Err, - [VariantOptionType(typeof(UnboundedUInt))] Ok } } \ No newline at end of file diff --git a/samples/Sample.Shared/Dex/Models/OrderPlacementReceipt.cs b/samples/Sample.Shared/Dex/Models/OrderPlacementReceipt.cs index 15d35793..ac20a8d2 100644 --- a/samples/Sample.Shared/Dex/Models/OrderPlacementReceipt.cs +++ b/samples/Sample.Shared/Dex/Models/OrderPlacementReceipt.cs @@ -1,11 +1,10 @@ using EdjCase.ICP.Candid.Mapping; using Sample.Shared.Dex.Models; using EdjCase.ICP.Candid.Models; -using System; namespace Sample.Shared.Dex.Models { - [Variant(typeof(OrderPlacementReceiptTag))] + [Variant()] public class OrderPlacementReceipt { [VariantTagProperty()] @@ -14,6 +13,10 @@ public class OrderPlacementReceipt [VariantValueProperty()] public object? Value { get; set; } + public OrderPlacementErr? Err { get => this.Tag == OrderPlacementReceiptTag.Err ? (OrderPlacementErr)this.Value! : default; set => (this.Tag, this.Value) = (OrderPlacementReceiptTag.Err, value); } + + public OptionalValue? Ok { get => this.Tag == OrderPlacementReceiptTag.Ok ? (OptionalValue)this.Value! : default; set => (this.Tag, this.Value) = (OrderPlacementReceiptTag.Ok, value); } + public OrderPlacementReceipt(OrderPlacementReceiptTag tag, object? value) { this.Tag = tag; @@ -23,43 +26,11 @@ public OrderPlacementReceipt(OrderPlacementReceiptTag tag, object? value) protected OrderPlacementReceipt() { } - - public static OrderPlacementReceipt Err(OrderPlacementErr info) - { - return new OrderPlacementReceipt(OrderPlacementReceiptTag.Err, info); - } - - public static OrderPlacementReceipt Ok(OptionalValue info) - { - return new OrderPlacementReceipt(OrderPlacementReceiptTag.Ok, info); - } - - public OrderPlacementErr AsErr() - { - this.ValidateTag(OrderPlacementReceiptTag.Err); - return (OrderPlacementErr)this.Value!; - } - - public OptionalValue AsOk() - { - this.ValidateTag(OrderPlacementReceiptTag.Ok); - return (OptionalValue)this.Value!; - } - - private void ValidateTag(OrderPlacementReceiptTag tag) - { - if (!this.Tag.Equals(tag)) - { - throw new InvalidOperationException($"Cannot cast '{this.Tag}' to type '{tag}'"); - } - } } public enum OrderPlacementReceiptTag { - [VariantOptionType(typeof(OrderPlacementErr))] Err, - [VariantOptionType(typeof(OptionalValue))] Ok } } \ No newline at end of file diff --git a/samples/Sample.Shared/Dex/Models/WithdrawReceipt.cs b/samples/Sample.Shared/Dex/Models/WithdrawReceipt.cs index 8fcea13b..10b6abc8 100644 --- a/samples/Sample.Shared/Dex/Models/WithdrawReceipt.cs +++ b/samples/Sample.Shared/Dex/Models/WithdrawReceipt.cs @@ -1,11 +1,10 @@ using EdjCase.ICP.Candid.Mapping; using Sample.Shared.Dex.Models; using EdjCase.ICP.Candid.Models; -using System; namespace Sample.Shared.Dex.Models { - [Variant(typeof(WithdrawReceiptTag))] + [Variant()] public class WithdrawReceipt { [VariantTagProperty()] @@ -14,6 +13,10 @@ public class WithdrawReceipt [VariantValueProperty()] public object? Value { get; set; } + public WithdrawErr? Err { get => this.Tag == WithdrawReceiptTag.Err ? (WithdrawErr)this.Value! : default; set => (this.Tag, this.Value) = (WithdrawReceiptTag.Err, value); } + + public UnboundedUInt? Ok { get => this.Tag == WithdrawReceiptTag.Ok ? (UnboundedUInt)this.Value! : default; set => (this.Tag, this.Value) = (WithdrawReceiptTag.Ok, value); } + public WithdrawReceipt(WithdrawReceiptTag tag, object? value) { this.Tag = tag; @@ -23,43 +26,11 @@ public WithdrawReceipt(WithdrawReceiptTag tag, object? value) protected WithdrawReceipt() { } - - public static WithdrawReceipt Err(WithdrawErr info) - { - return new WithdrawReceipt(WithdrawReceiptTag.Err, info); - } - - public static WithdrawReceipt Ok(UnboundedUInt info) - { - return new WithdrawReceipt(WithdrawReceiptTag.Ok, info); - } - - public WithdrawErr AsErr() - { - this.ValidateTag(WithdrawReceiptTag.Err); - return (WithdrawErr)this.Value!; - } - - public UnboundedUInt AsOk() - { - this.ValidateTag(WithdrawReceiptTag.Ok); - return (UnboundedUInt)this.Value!; - } - - private void ValidateTag(WithdrawReceiptTag tag) - { - if (!this.Tag.Equals(tag)) - { - throw new InvalidOperationException($"Cannot cast '{this.Tag}' to type '{tag}'"); - } - } } public enum WithdrawReceiptTag { - [VariantOptionType(typeof(WithdrawErr))] Err, - [VariantOptionType(typeof(UnboundedUInt))] Ok } } \ No newline at end of file diff --git a/samples/Sample.Shared/Governance/Models/AccountId.cs b/samples/Sample.Shared/Governance/Models/AccountId.cs index 490a3deb..e89a3d43 100644 --- a/samples/Sample.Shared/Governance/Models/AccountId.cs +++ b/samples/Sample.Shared/Governance/Models/AccountId.cs @@ -5,11 +5,11 @@ namespace Sample.Shared.Governance.Models public class AccountId { [CandidName("hash")] - public byte[] Hazh { get; set; } + public byte[] Hash { get; set; } - public AccountId(byte[] hazh) + public AccountId(byte[] hash) { - this.Hazh = hazh; + this.Hash = hash; } public AccountId() diff --git a/samples/Sample.Shared/Governance/Models/Action.cs b/samples/Sample.Shared/Governance/Models/Action.cs index 459c794d..f6c1d09c 100644 --- a/samples/Sample.Shared/Governance/Models/Action.cs +++ b/samples/Sample.Shared/Governance/Models/Action.cs @@ -4,7 +4,7 @@ namespace Sample.Shared.Governance.Models { - [Variant(typeof(ActionTag))] + [Variant()] public class Action { [VariantTagProperty()] @@ -23,9 +23,9 @@ protected Action() { } - public static Action RegisterKnownNeuron(KnownNeuron info) + public static Action RegisterNeuron(KnownNeuron info) { - return new Action(ActionTag.RegisterKnownNeuron, info); + return new Action(ActionTag.RegisterNeuron, info); } public static Action ManageNeuron(ManageNeuron info) @@ -88,9 +88,9 @@ public static Action Motion(Motion info) return new Action(ActionTag.Motion, info); } - public KnownNeuron AsRegisterKnownNeuron() + public KnownNeuron AsRegisterNeuron() { - this.ValidateTag(ActionTag.RegisterKnownNeuron); + this.ValidateTag(ActionTag.RegisterNeuron); return (KnownNeuron)this.Value!; } @@ -177,31 +177,19 @@ private void ValidateTag(ActionTag tag) public enum ActionTag { - [VariantOptionType(typeof(KnownNeuron))] - RegisterKnownNeuron, - [VariantOptionType(typeof(ManageNeuron))] + [CandidName("RegisterKnownNeuron")] + RegisterNeuron, ManageNeuron, - [VariantOptionType(typeof(CreateServiceNervousSystem))] CreateServiceNervousSystem, - [VariantOptionType(typeof(ExecuteNnsFunction))] ExecuteNnsFunction, - [VariantOptionType(typeof(RewardNodeProvider))] RewardNodeProvider, - [VariantOptionType(typeof(OpenSnsTokenSwap))] OpenSnsTokenSwap, - [VariantOptionType(typeof(SetSnsTokenSwapOpenTimeWindow))] SetSnsTokenSwapOpenTimeWindow, - [VariantOptionType(typeof(SetDefaultFollowees))] SetDefaultFollowees, - [VariantOptionType(typeof(RewardNodeProviders))] RewardNodeProviders, - [VariantOptionType(typeof(NetworkEconomics))] ManageNetworkEconomics, - [VariantOptionType(typeof(ApproveGenesisKyc))] ApproveGenesisKyc, - [VariantOptionType(typeof(AddOrRemoveNodeProvider))] AddOrRemoveNodeProvider, - [VariantOptionType(typeof(Motion))] Motion } } \ No newline at end of file diff --git a/samples/Sample.Shared/Governance/Models/By.cs b/samples/Sample.Shared/Governance/Models/By.cs index 8dfcf936..07345192 100644 --- a/samples/Sample.Shared/Governance/Models/By.cs +++ b/samples/Sample.Shared/Governance/Models/By.cs @@ -4,7 +4,7 @@ namespace Sample.Shared.Governance.Models { - [Variant(typeof(ByTag))] + [Variant()] public class By { [VariantTagProperty()] @@ -74,11 +74,8 @@ public NeuronIdOrSubaccountInfo() public enum ByTag { - [VariantOptionType(typeof(By.NeuronIdOrSubaccountInfo))] NeuronIdOrSubaccount, - [VariantOptionType(typeof(ClaimOrRefreshNeuronFromAccount))] MemoAndController, - [VariantOptionType(typeof(ulong))] Memo } } \ No newline at end of file diff --git a/samples/Sample.Shared/Governance/Models/Change.cs b/samples/Sample.Shared/Governance/Models/Change.cs index 4f918ff8..563b885d 100644 --- a/samples/Sample.Shared/Governance/Models/Change.cs +++ b/samples/Sample.Shared/Governance/Models/Change.cs @@ -4,7 +4,7 @@ namespace Sample.Shared.Governance.Models { - [Variant(typeof(ChangeTag))] + [Variant()] public class Change { [VariantTagProperty()] @@ -56,9 +56,7 @@ private void ValidateTag(ChangeTag tag) public enum ChangeTag { - [VariantOptionType(typeof(NodeProvider))] ToRemove, - [VariantOptionType(typeof(NodeProvider))] ToAdd } } \ No newline at end of file diff --git a/samples/Sample.Shared/Governance/Models/Command.cs b/samples/Sample.Shared/Governance/Models/Command.cs index 5e6b9fb8..6ecab138 100644 --- a/samples/Sample.Shared/Governance/Models/Command.cs +++ b/samples/Sample.Shared/Governance/Models/Command.cs @@ -4,7 +4,7 @@ namespace Sample.Shared.Governance.Models { - [Variant(typeof(CommandTag))] + [Variant()] public class Command { [VariantTagProperty()] @@ -166,29 +166,17 @@ private void ValidateTag(CommandTag tag) public enum CommandTag { - [VariantOptionType(typeof(Spawn))] Spawn, - [VariantOptionType(typeof(Split))] Split, - [VariantOptionType(typeof(Follow))] Follow, - [VariantOptionType(typeof(ClaimOrRefresh))] ClaimOrRefresh, - [VariantOptionType(typeof(Configure))] Configure, - [VariantOptionType(typeof(RegisterVote))] RegisterVote, - [VariantOptionType(typeof(Merge))] Merge, - [VariantOptionType(typeof(DisburseToNeuron))] DisburseToNeuron, - [VariantOptionType(typeof(Proposal))] MakeProposal, - [VariantOptionType(typeof(StakeMaturity))] StakeMaturity, - [VariantOptionType(typeof(MergeMaturity))] MergeMaturity, - [VariantOptionType(typeof(Disburse))] Disburse } } \ No newline at end of file diff --git a/samples/Sample.Shared/Governance/Models/Command1.cs b/samples/Sample.Shared/Governance/Models/Command1.cs index 3aa2170b..4b974821 100644 --- a/samples/Sample.Shared/Governance/Models/Command1.cs +++ b/samples/Sample.Shared/Governance/Models/Command1.cs @@ -4,7 +4,7 @@ namespace Sample.Shared.Governance.Models { - [Variant(typeof(Command1Tag))] + [Variant()] public class Command1 { [VariantTagProperty()] @@ -198,31 +198,18 @@ public RegisterVoteInfo() public enum Command1Tag { - [VariantOptionType(typeof(GovernanceError))] Error, - [VariantOptionType(typeof(SpawnResponse))] Spawn, - [VariantOptionType(typeof(SpawnResponse))] Split, - [VariantOptionType(typeof(Command1.FollowInfo))] Follow, - [VariantOptionType(typeof(ClaimOrRefreshResponse))] ClaimOrRefresh, - [VariantOptionType(typeof(Command1.ConfigureInfo))] Configure, - [VariantOptionType(typeof(Command1.RegisterVoteInfo))] RegisterVote, - [VariantOptionType(typeof(MergeResponse))] Merge, - [VariantOptionType(typeof(SpawnResponse))] DisburseToNeuron, - [VariantOptionType(typeof(MakeProposalResponse))] MakeProposal, - [VariantOptionType(typeof(StakeMaturityResponse))] StakeMaturity, - [VariantOptionType(typeof(MergeMaturityResponse))] MergeMaturity, - [VariantOptionType(typeof(DisburseResponse))] Disburse } } \ No newline at end of file diff --git a/samples/Sample.Shared/Governance/Models/Command2.cs b/samples/Sample.Shared/Governance/Models/Command2.cs index 37abc799..43deeefd 100644 --- a/samples/Sample.Shared/Governance/Models/Command2.cs +++ b/samples/Sample.Shared/Governance/Models/Command2.cs @@ -4,7 +4,7 @@ namespace Sample.Shared.Governance.Models { - [Variant(typeof(Command2Tag))] + [Variant()] public class Command2 { [VariantTagProperty()] @@ -140,23 +140,14 @@ public SyncCommandInfo() public enum Command2Tag { - [VariantOptionType(typeof(NeuronId))] Spawn, - [VariantOptionType(typeof(Split))] Split, - [VariantOptionType(typeof(Configure))] Configure, - [VariantOptionType(typeof(Merge))] Merge, - [VariantOptionType(typeof(DisburseToNeuron))] DisburseToNeuron, - [VariantOptionType(typeof(Command2.SyncCommandInfo))] SyncCommand, - [VariantOptionType(typeof(ClaimOrRefresh))] ClaimOrRefreshNeuron, - [VariantOptionType(typeof(MergeMaturity))] MergeMaturity, - [VariantOptionType(typeof(Disburse))] Disburse } } \ No newline at end of file diff --git a/samples/Sample.Shared/Governance/Models/DissolveState.cs b/samples/Sample.Shared/Governance/Models/DissolveState.cs index e8dc96c2..96dca45d 100644 --- a/samples/Sample.Shared/Governance/Models/DissolveState.cs +++ b/samples/Sample.Shared/Governance/Models/DissolveState.cs @@ -4,7 +4,7 @@ namespace Sample.Shared.Governance.Models { - [Variant(typeof(DissolveStateTag))] + [Variant()] public class DissolveState { [VariantTagProperty()] @@ -56,9 +56,7 @@ private void ValidateTag(DissolveStateTag tag) public enum DissolveStateTag { - [VariantOptionType(typeof(ulong))] DissolveDelaySeconds, - [VariantOptionType(typeof(ulong))] WhenDissolvedTimestampSeconds } } \ No newline at end of file diff --git a/samples/Sample.Shared/Governance/Models/Governance.cs b/samples/Sample.Shared/Governance/Models/Governance.cs index c5145755..d78caf94 100644 --- a/samples/Sample.Shared/Governance/Models/Governance.cs +++ b/samples/Sample.Shared/Governance/Models/Governance.cs @@ -8,7 +8,7 @@ namespace Sample.Shared.Governance.Models public class Governance { [CandidName("default_followees")] - public Dictionary DefaultFollowees { get; set; } + public List<(int, Followees)> DefaultFollowees { get; set; } [CandidName("making_sns_proposal")] public OptionalValue MakingSnsProposal { get; set; } @@ -53,18 +53,18 @@ public class Governance public OptionalValue Migrations { get; set; } [CandidName("proposals")] - public List<(ulong, ProposalData)> Proposals { get; set; } + public Dictionary Proposals { get; set; } [CandidName("in_flight_commands")] - public List<(ulong, NeuronInFlightCommand)> InFlightCommands { get; set; } + public Dictionary InFlightCommands { get; set; } [CandidName("neurons")] - public List<(ulong, Neuron)> Neurons { get; set; } + public Dictionary Neurons { get; set; } [CandidName("genesis_timestamp_seconds")] public ulong GenesisTimestampSeconds { get; set; } - public Governance(Dictionary defaultFollowees, OptionalValue makingSnsProposal, OptionalValue mostRecentMonthlyNodeProviderRewards, OptionalValue maturityModulationLastUpdatedAtTimestampSeconds, ulong waitForQuietThresholdSeconds, OptionalValue metrics, OptionalValue neuronManagementVotingPeriodSeconds, List nodeProviders, OptionalValue cachedDailyMaturityModulationBasisPoints, OptionalValue economics, OptionalValue spawningNeurons, OptionalValue latestRewardEvent, List toClaimTransfers, ulong shortVotingPeriodSeconds, OptionalValue migrations, List<(ulong, ProposalData)> proposals, List<(ulong, NeuronInFlightCommand)> inFlightCommands, List<(ulong, Neuron)> neurons, ulong genesisTimestampSeconds) + public Governance(List<(int, Followees)> defaultFollowees, OptionalValue makingSnsProposal, OptionalValue mostRecentMonthlyNodeProviderRewards, OptionalValue maturityModulationLastUpdatedAtTimestampSeconds, ulong waitForQuietThresholdSeconds, OptionalValue metrics, OptionalValue neuronManagementVotingPeriodSeconds, List nodeProviders, OptionalValue cachedDailyMaturityModulationBasisPoints, OptionalValue economics, OptionalValue spawningNeurons, OptionalValue latestRewardEvent, List toClaimTransfers, ulong shortVotingPeriodSeconds, OptionalValue migrations, Dictionary proposals, Dictionary inFlightCommands, Dictionary neurons, ulong genesisTimestampSeconds) { this.DefaultFollowees = defaultFollowees; this.MakingSnsProposal = makingSnsProposal; diff --git a/samples/Sample.Shared/Governance/Models/GovernanceCachedMetrics.cs b/samples/Sample.Shared/Governance/Models/GovernanceCachedMetrics.cs index b53d4e11..dfb23b66 100644 --- a/samples/Sample.Shared/Governance/Models/GovernanceCachedMetrics.cs +++ b/samples/Sample.Shared/Governance/Models/GovernanceCachedMetrics.cs @@ -9,7 +9,7 @@ public class GovernanceCachedMetrics public ulong TotalMaturityE8sEquivalent { get; set; } [CandidName("not_dissolving_neurons_e8s_buckets")] - public List<(ulong, double)> NotDissolvingNeuronsE8sBuckets { get; set; } + public Dictionary NotDissolvingNeuronsE8sBuckets { get; set; } [CandidName("dissolving_neurons_staked_maturity_e8s_equivalent_sum")] public ulong DissolvingNeuronsStakedMaturityE8sEquivalentSum { get; set; } @@ -18,13 +18,13 @@ public class GovernanceCachedMetrics public ulong GarbageCollectableNeuronsCount { get; set; } [CandidName("dissolving_neurons_staked_maturity_e8s_equivalent_buckets")] - public List<(ulong, double)> DissolvingNeuronsStakedMaturityE8sEquivalentBuckets { get; set; } + public Dictionary DissolvingNeuronsStakedMaturityE8sEquivalentBuckets { get; set; } [CandidName("neurons_with_invalid_stake_count")] public ulong NeuronsWithInvalidStakeCount { get; set; } [CandidName("not_dissolving_neurons_count_buckets")] - public List<(ulong, ulong)> NotDissolvingNeuronsCountBuckets { get; set; } + public Dictionary NotDissolvingNeuronsCountBuckets { get; set; } [CandidName("total_supply_icp")] public ulong TotalSupplyIcp { get; set; } @@ -63,16 +63,16 @@ public class GovernanceCachedMetrics public ulong NeuronsWithLessThan6MonthsDissolveDelayE8s { get; set; } [CandidName("not_dissolving_neurons_staked_maturity_e8s_equivalent_buckets")] - public List<(ulong, double)> NotDissolvingNeuronsStakedMaturityE8sEquivalentBuckets { get; set; } + public Dictionary NotDissolvingNeuronsStakedMaturityE8sEquivalentBuckets { get; set; } [CandidName("dissolving_neurons_count_buckets")] - public List<(ulong, ulong)> DissolvingNeuronsCountBuckets { get; set; } + public Dictionary DissolvingNeuronsCountBuckets { get; set; } [CandidName("dissolving_neurons_count")] public ulong DissolvingNeuronsCount { get; set; } [CandidName("dissolving_neurons_e8s_buckets")] - public List<(ulong, double)> DissolvingNeuronsE8sBuckets { get; set; } + public Dictionary DissolvingNeuronsE8sBuckets { get; set; } [CandidName("community_fund_total_staked_e8s")] public ulong CommunityFundTotalStakedE8s { get; set; } @@ -80,7 +80,7 @@ public class GovernanceCachedMetrics [CandidName("timestamp_seconds")] public ulong TimestampSeconds { get; set; } - public GovernanceCachedMetrics(ulong totalMaturityE8sEquivalent, List<(ulong, double)> notDissolvingNeuronsE8sBuckets, ulong dissolvingNeuronsStakedMaturityE8sEquivalentSum, ulong garbageCollectableNeuronsCount, List<(ulong, double)> dissolvingNeuronsStakedMaturityE8sEquivalentBuckets, ulong neuronsWithInvalidStakeCount, List<(ulong, ulong)> notDissolvingNeuronsCountBuckets, ulong totalSupplyIcp, ulong neuronsWithLessThan6MonthsDissolveDelayCount, ulong dissolvedNeuronsCount, ulong communityFundTotalMaturityE8sEquivalent, ulong totalStakedE8s, ulong notDissolvingNeuronsCount, ulong totalLockedE8s, ulong neuronsFundTotalActiveNeurons, ulong totalStakedMaturityE8sEquivalent, ulong notDissolvingNeuronsStakedMaturityE8sEquivalentSum, ulong dissolvedNeuronsE8s, ulong neuronsWithLessThan6MonthsDissolveDelayE8s, List<(ulong, double)> notDissolvingNeuronsStakedMaturityE8sEquivalentBuckets, List<(ulong, ulong)> dissolvingNeuronsCountBuckets, ulong dissolvingNeuronsCount, List<(ulong, double)> dissolvingNeuronsE8sBuckets, ulong communityFundTotalStakedE8s, ulong timestampSeconds) + public GovernanceCachedMetrics(ulong totalMaturityE8sEquivalent, Dictionary notDissolvingNeuronsE8sBuckets, ulong dissolvingNeuronsStakedMaturityE8sEquivalentSum, ulong garbageCollectableNeuronsCount, Dictionary dissolvingNeuronsStakedMaturityE8sEquivalentBuckets, ulong neuronsWithInvalidStakeCount, Dictionary notDissolvingNeuronsCountBuckets, ulong totalSupplyIcp, ulong neuronsWithLessThan6MonthsDissolveDelayCount, ulong dissolvedNeuronsCount, ulong communityFundTotalMaturityE8sEquivalent, ulong totalStakedE8s, ulong notDissolvingNeuronsCount, ulong totalLockedE8s, ulong neuronsFundTotalActiveNeurons, ulong totalStakedMaturityE8sEquivalent, ulong notDissolvingNeuronsStakedMaturityE8sEquivalentSum, ulong dissolvedNeuronsE8s, ulong neuronsWithLessThan6MonthsDissolveDelayE8s, Dictionary notDissolvingNeuronsStakedMaturityE8sEquivalentBuckets, Dictionary dissolvingNeuronsCountBuckets, ulong dissolvingNeuronsCount, Dictionary dissolvingNeuronsE8sBuckets, ulong communityFundTotalStakedE8s, ulong timestampSeconds) { this.TotalMaturityE8sEquivalent = totalMaturityE8sEquivalent; this.NotDissolvingNeuronsE8sBuckets = notDissolvingNeuronsE8sBuckets; diff --git a/samples/Sample.Shared/Governance/Models/ListNeuronsResponse.cs b/samples/Sample.Shared/Governance/Models/ListNeuronsResponse.cs index f6e59051..f9848755 100644 --- a/samples/Sample.Shared/Governance/Models/ListNeuronsResponse.cs +++ b/samples/Sample.Shared/Governance/Models/ListNeuronsResponse.cs @@ -7,12 +7,12 @@ namespace Sample.Shared.Governance.Models public class ListNeuronsResponse { [CandidName("neuron_infos")] - public List<(ulong, NeuronInfo)> NeuronInfos { get; set; } + public Dictionary NeuronInfos { get; set; } [CandidName("full_neurons")] public List FullNeurons { get; set; } - public ListNeuronsResponse(List<(ulong, NeuronInfo)> neuronInfos, List fullNeurons) + public ListNeuronsResponse(Dictionary neuronInfos, List fullNeurons) { this.NeuronInfos = neuronInfos; this.FullNeurons = fullNeurons; diff --git a/samples/Sample.Shared/Governance/Models/Neuron.cs b/samples/Sample.Shared/Governance/Models/Neuron.cs index 7c41f897..224303e4 100644 --- a/samples/Sample.Shared/Governance/Models/Neuron.cs +++ b/samples/Sample.Shared/Governance/Models/Neuron.cs @@ -53,7 +53,7 @@ public class Neuron public OptionalValue DissolveState { get; set; } [CandidName("followees")] - public List<(int, Followees)> Followees { get; set; } + public Dictionary Followees { get; set; } [CandidName("neuron_fees_e8s")] public ulong NeuronFeesE8s { get; set; } @@ -67,7 +67,7 @@ public class Neuron [CandidName("spawn_at_timestamp_seconds")] public OptionalValue SpawnAtTimestampSeconds { get; set; } - public Neuron(OptionalValue id, OptionalValue stakedMaturityE8sEquivalent, OptionalValue controller, List recentBallots, bool kycVerified, bool notForProfit, ulong maturityE8sEquivalent, ulong cachedNeuronStakeE8s, ulong createdTimestampSeconds, OptionalValue autoStakeMaturity, ulong agingSinceTimestampSeconds, List hotKeys, List account, OptionalValue joinedCommunityFundTimestampSeconds, OptionalValue dissolveState, List<(int, Followees)> followees, ulong neuronFeesE8s, OptionalValue transfer, OptionalValue knownNeuronData, OptionalValue spawnAtTimestampSeconds) + public Neuron(OptionalValue id, OptionalValue stakedMaturityE8sEquivalent, OptionalValue controller, List recentBallots, bool kycVerified, bool notForProfit, ulong maturityE8sEquivalent, ulong cachedNeuronStakeE8s, ulong createdTimestampSeconds, OptionalValue autoStakeMaturity, ulong agingSinceTimestampSeconds, List hotKeys, List account, OptionalValue joinedCommunityFundTimestampSeconds, OptionalValue dissolveState, Dictionary followees, ulong neuronFeesE8s, OptionalValue transfer, OptionalValue knownNeuronData, OptionalValue spawnAtTimestampSeconds) { this.Id = id; this.StakedMaturityE8sEquivalent = stakedMaturityE8sEquivalent; diff --git a/samples/Sample.Shared/Governance/Models/NeuronIdOrSubaccount.cs b/samples/Sample.Shared/Governance/Models/NeuronIdOrSubaccount.cs index b473cb5e..4822b6d1 100644 --- a/samples/Sample.Shared/Governance/Models/NeuronIdOrSubaccount.cs +++ b/samples/Sample.Shared/Governance/Models/NeuronIdOrSubaccount.cs @@ -5,7 +5,7 @@ namespace Sample.Shared.Governance.Models { - [Variant(typeof(NeuronIdOrSubaccountTag))] + [Variant()] public class NeuronIdOrSubaccount { [VariantTagProperty()] @@ -57,9 +57,7 @@ private void ValidateTag(NeuronIdOrSubaccountTag tag) public enum NeuronIdOrSubaccountTag { - [VariantOptionType(typeof(List))] Subaccount, - [VariantOptionType(typeof(NeuronId))] NeuronId } } \ No newline at end of file diff --git a/samples/Sample.Shared/Governance/Models/Operation.cs b/samples/Sample.Shared/Governance/Models/Operation.cs index e08204af..fc3612bd 100644 --- a/samples/Sample.Shared/Governance/Models/Operation.cs +++ b/samples/Sample.Shared/Governance/Models/Operation.cs @@ -4,7 +4,7 @@ namespace Sample.Shared.Governance.Models { - [Variant(typeof(OperationTag))] + [Variant()] public class Operation { [VariantTagProperty()] @@ -161,23 +161,14 @@ public LeaveCommunityFundInfo() public enum OperationTag { - [VariantOptionType(typeof(RemoveHotKey))] RemoveHotKey, - [VariantOptionType(typeof(AddHotKey))] AddHotKey, - [VariantOptionType(typeof(ChangeAutoStakeMaturity))] ChangeAutoStakeMaturity, - [VariantOptionType(typeof(Operation.StopDissolvingInfo))] StopDissolving, - [VariantOptionType(typeof(Operation.StartDissolvingInfo))] StartDissolving, - [VariantOptionType(typeof(IncreaseDissolveDelay))] IncreaseDissolveDelay, - [VariantOptionType(typeof(Operation.JoinCommunityFundInfo))] JoinCommunityFund, - [VariantOptionType(typeof(Operation.LeaveCommunityFundInfo))] LeaveCommunityFund, - [VariantOptionType(typeof(SetDissolveTimestamp))] SetDissolveTimestamp } } \ No newline at end of file diff --git a/samples/Sample.Shared/Governance/Models/Progress.cs b/samples/Sample.Shared/Governance/Models/Progress.cs index afa81c07..d94733f3 100644 --- a/samples/Sample.Shared/Governance/Models/Progress.cs +++ b/samples/Sample.Shared/Governance/Models/Progress.cs @@ -4,7 +4,7 @@ namespace Sample.Shared.Governance.Models { - [Variant(typeof(ProgressTag))] + [Variant()] public class Progress { [VariantTagProperty()] @@ -45,7 +45,6 @@ private void ValidateTag(ProgressTag tag) public enum ProgressTag { - [VariantOptionType(typeof(NeuronId))] LastNeuronId } } \ No newline at end of file diff --git a/samples/Sample.Shared/Governance/Models/ProposalData.cs b/samples/Sample.Shared/Governance/Models/ProposalData.cs index ef2ba797..d627e6e2 100644 --- a/samples/Sample.Shared/Governance/Models/ProposalData.cs +++ b/samples/Sample.Shared/Governance/Models/ProposalData.cs @@ -17,7 +17,7 @@ public class ProposalData public List CfParticipants { get; set; } [CandidName("ballots")] - public List<(ulong, Ballot)> Ballots { get; set; } + public Dictionary Ballots { get; set; } [CandidName("proposal_timestamp_seconds")] public ulong ProposalTimestampSeconds { get; set; } @@ -58,7 +58,7 @@ public class ProposalData [CandidName("original_total_community_fund_maturity_e8s_equivalent")] public OptionalValue OriginalTotalCommunityFundMaturityE8sEquivalent { get; set; } - public ProposalData(OptionalValue id, OptionalValue failureReason, List cfParticipants, List<(ulong, Ballot)> ballots, ulong proposalTimestampSeconds, ulong rewardEventRound, ulong failedTimestampSeconds, ulong rejectCostE8s, OptionalValue derivedProposalInformation, OptionalValue latestTally, OptionalValue snsTokenSwapLifecycle, ulong decidedTimestampSeconds, OptionalValue proposal, OptionalValue proposer, OptionalValue waitForQuietState, ulong executedTimestampSeconds, OptionalValue originalTotalCommunityFundMaturityE8sEquivalent) + public ProposalData(OptionalValue id, OptionalValue failureReason, List cfParticipants, Dictionary ballots, ulong proposalTimestampSeconds, ulong rewardEventRound, ulong failedTimestampSeconds, ulong rejectCostE8s, OptionalValue derivedProposalInformation, OptionalValue latestTally, OptionalValue snsTokenSwapLifecycle, ulong decidedTimestampSeconds, OptionalValue proposal, OptionalValue proposer, OptionalValue waitForQuietState, ulong executedTimestampSeconds, OptionalValue originalTotalCommunityFundMaturityE8sEquivalent) { this.Id = id; this.FailureReason = failureReason; diff --git a/samples/Sample.Shared/Governance/Models/ProposalInfo.cs b/samples/Sample.Shared/Governance/Models/ProposalInfo.cs index 05066afd..ccf6b71b 100644 --- a/samples/Sample.Shared/Governance/Models/ProposalInfo.cs +++ b/samples/Sample.Shared/Governance/Models/ProposalInfo.cs @@ -20,7 +20,7 @@ public class ProposalInfo public OptionalValue FailureReason { get; set; } [CandidName("ballots")] - public List<(ulong, Ballot)> Ballots { get; set; } + public Dictionary Ballots { get; set; } [CandidName("proposal_timestamp_seconds")] public ulong ProposalTimestampSeconds { get; set; } @@ -58,7 +58,7 @@ public class ProposalInfo [CandidName("executed_timestamp_seconds")] public ulong ExecutedTimestampSeconds { get; set; } - public ProposalInfo(OptionalValue id, int status, int topic, OptionalValue failureReason, List<(ulong, Ballot)> ballots, ulong proposalTimestampSeconds, ulong rewardEventRound, OptionalValue deadlineTimestampSeconds, ulong failedTimestampSeconds, ulong rejectCostE8s, OptionalValue derivedProposalInformation, OptionalValue latestTally, int rewardStatus, ulong decidedTimestampSeconds, OptionalValue proposal, OptionalValue proposer, ulong executedTimestampSeconds) + public ProposalInfo(OptionalValue id, int status, int topic, OptionalValue failureReason, Dictionary ballots, ulong proposalTimestampSeconds, ulong rewardEventRound, OptionalValue deadlineTimestampSeconds, ulong failedTimestampSeconds, ulong rejectCostE8s, OptionalValue derivedProposalInformation, OptionalValue latestTally, int rewardStatus, ulong decidedTimestampSeconds, OptionalValue proposal, OptionalValue proposer, ulong executedTimestampSeconds) { this.Id = id; this.Status = status; diff --git a/samples/Sample.Shared/Governance/Models/Result.cs b/samples/Sample.Shared/Governance/Models/Result.cs index da620e48..a28ad572 100644 --- a/samples/Sample.Shared/Governance/Models/Result.cs +++ b/samples/Sample.Shared/Governance/Models/Result.cs @@ -4,7 +4,7 @@ namespace Sample.Shared.Governance.Models { - [Variant(typeof(ResultTag))] + [Variant()] public class Result { [VariantTagProperty()] @@ -51,7 +51,6 @@ private void ValidateTag(ResultTag tag) public enum ResultTag { Ok, - [VariantOptionType(typeof(GovernanceError))] Err } } \ No newline at end of file diff --git a/samples/Sample.Shared/Governance/Models/Result1.cs b/samples/Sample.Shared/Governance/Models/Result1.cs index 65890925..fd43e2ba 100644 --- a/samples/Sample.Shared/Governance/Models/Result1.cs +++ b/samples/Sample.Shared/Governance/Models/Result1.cs @@ -4,7 +4,7 @@ namespace Sample.Shared.Governance.Models { - [Variant(typeof(Result1Tag))] + [Variant()] public class Result1 { [VariantTagProperty()] @@ -56,9 +56,7 @@ private void ValidateTag(Result1Tag tag) public enum Result1Tag { - [VariantOptionType(typeof(GovernanceError))] Error, - [VariantOptionType(typeof(NeuronId))] NeuronId } } \ No newline at end of file diff --git a/samples/Sample.Shared/Governance/Models/Result2.cs b/samples/Sample.Shared/Governance/Models/Result2.cs index 81253fa8..673f09fc 100644 --- a/samples/Sample.Shared/Governance/Models/Result2.cs +++ b/samples/Sample.Shared/Governance/Models/Result2.cs @@ -4,7 +4,7 @@ namespace Sample.Shared.Governance.Models { - [Variant(typeof(Result2Tag))] + [Variant()] public class Result2 { [VariantTagProperty()] @@ -56,9 +56,7 @@ private void ValidateTag(Result2Tag tag) public enum Result2Tag { - [VariantOptionType(typeof(Neuron))] Ok, - [VariantOptionType(typeof(GovernanceError))] Err } } \ No newline at end of file diff --git a/samples/Sample.Shared/Governance/Models/Result3.cs b/samples/Sample.Shared/Governance/Models/Result3.cs index 28f97c56..d1f83ee0 100644 --- a/samples/Sample.Shared/Governance/Models/Result3.cs +++ b/samples/Sample.Shared/Governance/Models/Result3.cs @@ -4,7 +4,7 @@ namespace Sample.Shared.Governance.Models { - [Variant(typeof(Result3Tag))] + [Variant()] public class Result3 { [VariantTagProperty()] @@ -56,9 +56,7 @@ private void ValidateTag(Result3Tag tag) public enum Result3Tag { - [VariantOptionType(typeof(GovernanceCachedMetrics))] Ok, - [VariantOptionType(typeof(GovernanceError))] Err } } \ No newline at end of file diff --git a/samples/Sample.Shared/Governance/Models/Result4.cs b/samples/Sample.Shared/Governance/Models/Result4.cs index 5d4ba0d3..039d7ac3 100644 --- a/samples/Sample.Shared/Governance/Models/Result4.cs +++ b/samples/Sample.Shared/Governance/Models/Result4.cs @@ -4,7 +4,7 @@ namespace Sample.Shared.Governance.Models { - [Variant(typeof(Result4Tag))] + [Variant()] public class Result4 { [VariantTagProperty()] @@ -56,9 +56,7 @@ private void ValidateTag(Result4Tag tag) public enum Result4Tag { - [VariantOptionType(typeof(RewardNodeProviders))] Ok, - [VariantOptionType(typeof(GovernanceError))] Err } } \ No newline at end of file diff --git a/samples/Sample.Shared/Governance/Models/Result5.cs b/samples/Sample.Shared/Governance/Models/Result5.cs index 45fa0267..0a5758fa 100644 --- a/samples/Sample.Shared/Governance/Models/Result5.cs +++ b/samples/Sample.Shared/Governance/Models/Result5.cs @@ -4,7 +4,7 @@ namespace Sample.Shared.Governance.Models { - [Variant(typeof(Result5Tag))] + [Variant()] public class Result5 { [VariantTagProperty()] @@ -56,9 +56,7 @@ private void ValidateTag(Result5Tag tag) public enum Result5Tag { - [VariantOptionType(typeof(NeuronInfo))] Ok, - [VariantOptionType(typeof(GovernanceError))] Err } } \ No newline at end of file diff --git a/samples/Sample.Shared/Governance/Models/Result6.cs b/samples/Sample.Shared/Governance/Models/Result6.cs index 7df769c1..e4226631 100644 --- a/samples/Sample.Shared/Governance/Models/Result6.cs +++ b/samples/Sample.Shared/Governance/Models/Result6.cs @@ -4,7 +4,7 @@ namespace Sample.Shared.Governance.Models { - [Variant(typeof(Result6Tag))] + [Variant()] public class Result6 { [VariantTagProperty()] @@ -56,9 +56,7 @@ private void ValidateTag(Result6Tag tag) public enum Result6Tag { - [VariantOptionType(typeof(NodeProvider))] Ok, - [VariantOptionType(typeof(GovernanceError))] Err } } \ No newline at end of file diff --git a/samples/Sample.Shared/Governance/Models/Result7.cs b/samples/Sample.Shared/Governance/Models/Result7.cs index 41434dd2..ac88252a 100644 --- a/samples/Sample.Shared/Governance/Models/Result7.cs +++ b/samples/Sample.Shared/Governance/Models/Result7.cs @@ -4,7 +4,7 @@ namespace Sample.Shared.Governance.Models { - [Variant(typeof(Result7Tag))] + [Variant()] public class Result7 { [VariantTagProperty()] @@ -63,9 +63,7 @@ public AbortedInfo() public enum Result7Tag { - [VariantOptionType(typeof(Committed))] Committed, - [VariantOptionType(typeof(Result7.AbortedInfo))] Aborted } } \ No newline at end of file diff --git a/samples/Sample.Shared/Governance/Models/RewardMode.cs b/samples/Sample.Shared/Governance/Models/RewardMode.cs index aa724c41..dd6a8b8a 100644 --- a/samples/Sample.Shared/Governance/Models/RewardMode.cs +++ b/samples/Sample.Shared/Governance/Models/RewardMode.cs @@ -4,7 +4,7 @@ namespace Sample.Shared.Governance.Models { - [Variant(typeof(RewardModeTag))] + [Variant()] public class RewardMode { [VariantTagProperty()] @@ -56,9 +56,7 @@ private void ValidateTag(RewardModeTag tag) public enum RewardModeTag { - [VariantOptionType(typeof(RewardToNeuron))] RewardToNeuron, - [VariantOptionType(typeof(RewardToAccount))] RewardToAccount } } \ No newline at end of file diff --git a/samples/Sample.Shared/Governance/Models/SetDefaultFollowees.cs b/samples/Sample.Shared/Governance/Models/SetDefaultFollowees.cs index 4b37295d..de99b77b 100644 --- a/samples/Sample.Shared/Governance/Models/SetDefaultFollowees.cs +++ b/samples/Sample.Shared/Governance/Models/SetDefaultFollowees.cs @@ -7,9 +7,9 @@ namespace Sample.Shared.Governance.Models public class SetDefaultFollowees { [CandidName("default_followees")] - public List<(int, Followees)> DefaultFollowees { get; set; } + public Dictionary DefaultFollowees { get; set; } - public SetDefaultFollowees(List<(int, Followees)> defaultFollowees) + public SetDefaultFollowees(Dictionary defaultFollowees) { this.DefaultFollowees = defaultFollowees; } diff --git a/samples/Sample.Shared/ICRC1Ledger/ICRC1LedgerApiClient.cs b/samples/Sample.Shared/ICRC1Ledger/ICRC1LedgerApiClient.cs index b32b1c8f..2e9f01c9 100644 --- a/samples/Sample.Shared/ICRC1Ledger/ICRC1LedgerApiClient.cs +++ b/samples/Sample.Shared/ICRC1Ledger/ICRC1LedgerApiClient.cs @@ -2,10 +2,9 @@ using EdjCase.ICP.Candid.Models; using EdjCase.ICP.Candid; using System.Threading.Tasks; +using Sample.Shared.ICRC1Ledger; using EdjCase.ICP.Agent.Responses; using System.Collections.Generic; -using Sample.Shared.ICRC1Ledger; -using EdjCase.ICP.Candid.Mapping; using Tokens = EdjCase.ICP.Candid.Models.UnboundedUInt; namespace Sample.Shared.ICRC1Ledger @@ -25,6 +24,30 @@ public ICRC1LedgerApiClient(IAgent agent, Principal canisterId, CandidConverter? this.Converter = converter; } + public async Task GetTransactions(Models.GetTransactionsRequest arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_transactions", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + + public async Task GetBlocks(Models.GetBlocksArgs arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_blocks", arg); + CandidArg reply = response.ThrowOrGetReply(); + 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(); + return reply.ToObjects(this.Converter); + } + public async Task Icrc1Name() { CandidArg arg = CandidArg.FromCandid(); @@ -49,12 +72,12 @@ public async Task Icrc1Decimals() return reply.ToObjects(this.Converter); } - public async Task> Icrc1Metadata() + public async Task> Icrc1Metadata() { CandidArg arg = CandidArg.FromCandid(); QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "icrc1_metadata", arg); CandidArg reply = response.ThrowOrGetReply(); - return reply.ToObjects>(this.Converter); + return reply.ToObjects>(this.Converter); } public async Task Icrc1TotalSupply() @@ -96,55 +119,34 @@ public async Task Icrc1BalanceOf(Models.Account arg0) return reply.ToObjects(this.Converter); } - public async Task> Icrc1SupportedStandards() + public async Task> Icrc1SupportedStandards() { CandidArg arg = CandidArg.FromCandid(); QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "icrc1_supported_standards", arg); CandidArg reply = response.ThrowOrGetReply(); - return reply.ToObjects>(this.Converter); + return reply.ToObjects>(this.Converter); } - public async Task GetTransactions(Models.GetTransactionsRequest arg0) + public async Task Icrc2Approve(Models.ApproveArgs arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_transactions", arg); - CandidArg reply = response.ThrowOrGetReply(); - return reply.ToObjects(this.Converter); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "icrc2_approve", arg); + return reply.ToObjects(this.Converter); } - public async Task GetBlocks(Models.GetBlocksArgs arg0) + public async Task Icrc2Allowance(Models.AllowanceArgs arg0) { CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); - QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_blocks", arg); - CandidArg reply = response.ThrowOrGetReply(); - 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); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "icrc2_allowance", arg); CandidArg reply = response.ThrowOrGetReply(); - return reply.ToObjects(this.Converter); + return reply.ToObjects(this.Converter); } - public class Icrc1SupportedStandardsArg0Item + public async Task Icrc2TransferFrom(Models.TransferFromArgs arg0) { - [CandidName("name")] - public string Name { get; set; } - - [CandidName("url")] - public string Url { get; set; } - - public Icrc1SupportedStandardsArg0Item(string name, string url) - { - this.Name = name; - this.Url = url; - } - - public Icrc1SupportedStandardsArg0Item() - { - } + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "icrc2_transfer_from", arg); + return reply.ToObjects(this.Converter); } } } \ No newline at end of file diff --git a/samples/Sample.Shared/ICRC1Ledger/Models/Allowance.cs b/samples/Sample.Shared/ICRC1Ledger/Models/Allowance.cs new file mode 100644 index 00000000..c08cf43d --- /dev/null +++ b/samples/Sample.Shared/ICRC1Ledger/Models/Allowance.cs @@ -0,0 +1,25 @@ +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Timestamp = System.UInt64; + +namespace Sample.Shared.ICRC1Ledger.Models +{ + public class Allowance + { + [CandidName("allowance")] + public UnboundedUInt Allowance_ { get; set; } + + [CandidName("expires_at")] + public OptionalValue ExpiresAt { get; set; } + + public Allowance(UnboundedUInt allowance, OptionalValue expiresAt) + { + this.Allowance_ = allowance; + this.ExpiresAt = expiresAt; + } + + public Allowance() + { + } + } +} \ No newline at end of file diff --git a/samples/Sample.Shared/ICRC1Ledger/Models/AllowanceArgs.cs b/samples/Sample.Shared/ICRC1Ledger/Models/AllowanceArgs.cs new file mode 100644 index 00000000..7c91a196 --- /dev/null +++ b/samples/Sample.Shared/ICRC1Ledger/Models/AllowanceArgs.cs @@ -0,0 +1,24 @@ +using EdjCase.ICP.Candid.Mapping; +using Sample.Shared.ICRC1Ledger.Models; + +namespace Sample.Shared.ICRC1Ledger.Models +{ + public class AllowanceArgs + { + [CandidName("account")] + public Account Account { get; set; } + + [CandidName("spender")] + public Account Spender { get; set; } + + public AllowanceArgs(Account account, Account spender) + { + this.Account = account; + this.Spender = spender; + } + + public AllowanceArgs() + { + } + } +} \ No newline at end of file diff --git a/samples/Sample.Shared/ICRC1Ledger/Models/Approve.cs b/samples/Sample.Shared/ICRC1Ledger/Models/Approve.cs new file mode 100644 index 00000000..6fd28296 --- /dev/null +++ b/samples/Sample.Shared/ICRC1Ledger/Models/Approve.cs @@ -0,0 +1,51 @@ +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Sample.Shared.ICRC1Ledger.Models; +using System.Collections.Generic; +using Timestamp = System.UInt64; + +namespace Sample.Shared.ICRC1Ledger.Models +{ + public class Approve + { + [CandidName("fee")] + public OptionalValue Fee { get; set; } + + [CandidName("from")] + public Account From { get; set; } + + [CandidName("memo")] + public OptionalValue> Memo { get; set; } + + [CandidName("created_at_time")] + public OptionalValue CreatedAtTime { get; set; } + + [CandidName("amount")] + public UnboundedUInt Amount { get; set; } + + [CandidName("expected_allowance")] + public OptionalValue ExpectedAllowance { get; set; } + + [CandidName("expires_at")] + public OptionalValue ExpiresAt { get; set; } + + [CandidName("spender")] + public Account Spender { get; set; } + + public Approve(OptionalValue fee, Account from, OptionalValue> memo, OptionalValue createdAtTime, UnboundedUInt amount, OptionalValue expectedAllowance, OptionalValue expiresAt, Account spender) + { + this.Fee = fee; + this.From = from; + this.Memo = memo; + this.CreatedAtTime = createdAtTime; + this.Amount = amount; + this.ExpectedAllowance = expectedAllowance; + this.ExpiresAt = expiresAt; + this.Spender = spender; + } + + public Approve() + { + } + } +} \ No newline at end of file diff --git a/samples/Sample.Shared/ICRC1Ledger/Models/ApproveArgs.cs b/samples/Sample.Shared/ICRC1Ledger/Models/ApproveArgs.cs new file mode 100644 index 00000000..06f8f664 --- /dev/null +++ b/samples/Sample.Shared/ICRC1Ledger/Models/ApproveArgs.cs @@ -0,0 +1,51 @@ +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using System.Collections.Generic; +using Sample.Shared.ICRC1Ledger.Models; +using Timestamp = System.UInt64; + +namespace Sample.Shared.ICRC1Ledger.Models +{ + public class ApproveArgs + { + [CandidName("fee")] + public OptionalValue Fee { get; set; } + + [CandidName("memo")] + public OptionalValue> Memo { get; set; } + + [CandidName("from_subaccount")] + public OptionalValue> FromSubaccount { get; set; } + + [CandidName("created_at_time")] + public OptionalValue CreatedAtTime { get; set; } + + [CandidName("amount")] + public UnboundedUInt Amount { get; set; } + + [CandidName("expected_allowance")] + public OptionalValue ExpectedAllowance { get; set; } + + [CandidName("expires_at")] + public OptionalValue ExpiresAt { get; set; } + + [CandidName("spender")] + public Account Spender { get; set; } + + public ApproveArgs(OptionalValue fee, OptionalValue> memo, OptionalValue> fromSubaccount, OptionalValue createdAtTime, UnboundedUInt amount, OptionalValue expectedAllowance, OptionalValue expiresAt, Account spender) + { + this.Fee = fee; + this.Memo = memo; + this.FromSubaccount = fromSubaccount; + this.CreatedAtTime = createdAtTime; + this.Amount = amount; + this.ExpectedAllowance = expectedAllowance; + this.ExpiresAt = expiresAt; + this.Spender = spender; + } + + public ApproveArgs() + { + } + } +} \ No newline at end of file diff --git a/samples/Sample.Shared/ICRC1Ledger/Models/ApproveError.cs b/samples/Sample.Shared/ICRC1Ledger/Models/ApproveError.cs new file mode 100644 index 00000000..c7a67d1b --- /dev/null +++ b/samples/Sample.Shared/ICRC1Ledger/Models/ApproveError.cs @@ -0,0 +1,246 @@ +using EdjCase.ICP.Candid.Mapping; +using Sample.Shared.ICRC1Ledger.Models; +using System; +using EdjCase.ICP.Candid.Models; +using BlockIndex = EdjCase.ICP.Candid.Models.UnboundedUInt; +using Timestamp = System.UInt64; + +namespace Sample.Shared.ICRC1Ledger.Models +{ + [Variant()] + public class ApproveError + { + [VariantTagProperty()] + public ApproveErrorTag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public ApproveError(ApproveErrorTag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected ApproveError() + { + } + + public static ApproveError GenericError(ApproveError.GenericErrorInfo info) + { + return new ApproveError(ApproveErrorTag.GenericError, info); + } + + public static ApproveError TemporarilyUnavailable() + { + return new ApproveError(ApproveErrorTag.TemporarilyUnavailable, null); + } + + public static ApproveError Duplicate(ApproveError.DuplicateInfo info) + { + return new ApproveError(ApproveErrorTag.Duplicate, info); + } + + public static ApproveError BadFee(ApproveError.BadFeeInfo info) + { + return new ApproveError(ApproveErrorTag.BadFee, info); + } + + public static ApproveError AllowanceChanged(ApproveError.AllowanceChangedInfo info) + { + return new ApproveError(ApproveErrorTag.AllowanceChanged, info); + } + + public static ApproveError CreatedInFuture(ApproveError.CreatedInFutureInfo info) + { + return new ApproveError(ApproveErrorTag.CreatedInFuture, info); + } + + public static ApproveError TooOld() + { + return new ApproveError(ApproveErrorTag.TooOld, null); + } + + public static ApproveError Expired(ApproveError.ExpiredInfo info) + { + return new ApproveError(ApproveErrorTag.Expired, info); + } + + public static ApproveError InsufficientFunds(ApproveError.InsufficientFundsInfo info) + { + return new ApproveError(ApproveErrorTag.InsufficientFunds, info); + } + + public ApproveError.GenericErrorInfo AsGenericError() + { + this.ValidateTag(ApproveErrorTag.GenericError); + return (ApproveError.GenericErrorInfo)this.Value!; + } + + public ApproveError.DuplicateInfo AsDuplicate() + { + this.ValidateTag(ApproveErrorTag.Duplicate); + return (ApproveError.DuplicateInfo)this.Value!; + } + + public ApproveError.BadFeeInfo AsBadFee() + { + this.ValidateTag(ApproveErrorTag.BadFee); + return (ApproveError.BadFeeInfo)this.Value!; + } + + public ApproveError.AllowanceChangedInfo AsAllowanceChanged() + { + this.ValidateTag(ApproveErrorTag.AllowanceChanged); + return (ApproveError.AllowanceChangedInfo)this.Value!; + } + + public ApproveError.CreatedInFutureInfo AsCreatedInFuture() + { + this.ValidateTag(ApproveErrorTag.CreatedInFuture); + return (ApproveError.CreatedInFutureInfo)this.Value!; + } + + public ApproveError.ExpiredInfo AsExpired() + { + this.ValidateTag(ApproveErrorTag.Expired); + return (ApproveError.ExpiredInfo)this.Value!; + } + + public ApproveError.InsufficientFundsInfo AsInsufficientFunds() + { + this.ValidateTag(ApproveErrorTag.InsufficientFunds); + return (ApproveError.InsufficientFundsInfo)this.Value!; + } + + private void ValidateTag(ApproveErrorTag tag) + { + if (!this.Tag.Equals(tag)) + { + throw new InvalidOperationException($"Cannot cast '{this.Tag}' to type '{tag}'"); + } + } + + public class GenericErrorInfo + { + [CandidName("message")] + public string Message { get; set; } + + [CandidName("error_code")] + public UnboundedUInt ErrorCode { get; set; } + + public GenericErrorInfo(string message, UnboundedUInt errorCode) + { + this.Message = message; + this.ErrorCode = errorCode; + } + + public GenericErrorInfo() + { + } + } + + public class DuplicateInfo + { + [CandidName("duplicate_of")] + public BlockIndex DuplicateOf { get; set; } + + public DuplicateInfo(BlockIndex duplicateOf) + { + this.DuplicateOf = duplicateOf; + } + + public DuplicateInfo() + { + } + } + + public class BadFeeInfo + { + [CandidName("expected_fee")] + public UnboundedUInt ExpectedFee { get; set; } + + public BadFeeInfo(UnboundedUInt expectedFee) + { + this.ExpectedFee = expectedFee; + } + + public BadFeeInfo() + { + } + } + + public class AllowanceChangedInfo + { + [CandidName("current_allowance")] + public UnboundedUInt CurrentAllowance { get; set; } + + public AllowanceChangedInfo(UnboundedUInt currentAllowance) + { + this.CurrentAllowance = currentAllowance; + } + + public AllowanceChangedInfo() + { + } + } + + public class CreatedInFutureInfo + { + [CandidName("ledger_time")] + public Timestamp LedgerTime { get; set; } + + public CreatedInFutureInfo(Timestamp ledgerTime) + { + this.LedgerTime = ledgerTime; + } + + public CreatedInFutureInfo() + { + } + } + + public class ExpiredInfo + { + [CandidName("ledger_time")] + public Timestamp LedgerTime { get; set; } + + public ExpiredInfo(Timestamp ledgerTime) + { + this.LedgerTime = ledgerTime; + } + + public ExpiredInfo() + { + } + } + + public class InsufficientFundsInfo + { + [CandidName("balance")] + public UnboundedUInt Balance { get; set; } + + public InsufficientFundsInfo(UnboundedUInt balance) + { + this.Balance = balance; + } + + public InsufficientFundsInfo() + { + } + } + } + + public enum ApproveErrorTag + { + GenericError, + TemporarilyUnavailable, + Duplicate, + BadFee, + AllowanceChanged, + CreatedInFuture, + TooOld, + Expired, + InsufficientFunds + } +} \ No newline at end of file diff --git a/samples/Sample.Shared/ICRC1Ledger/Models/ApproveResult.cs b/samples/Sample.Shared/ICRC1Ledger/Models/ApproveResult.cs new file mode 100644 index 00000000..5fd7c701 --- /dev/null +++ b/samples/Sample.Shared/ICRC1Ledger/Models/ApproveResult.cs @@ -0,0 +1,63 @@ +using EdjCase.ICP.Candid.Mapping; +using Sample.Shared.ICRC1Ledger.Models; +using System; +using BlockIndex = EdjCase.ICP.Candid.Models.UnboundedUInt; + +namespace Sample.Shared.ICRC1Ledger.Models +{ + [Variant()] + public class ApproveResult + { + [VariantTagProperty()] + public ApproveResultTag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public ApproveResult(ApproveResultTag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected ApproveResult() + { + } + + public static ApproveResult Ok(BlockIndex info) + { + return new ApproveResult(ApproveResultTag.Ok, info); + } + + public static ApproveResult Err(ApproveError info) + { + return new ApproveResult(ApproveResultTag.Err, info); + } + + public BlockIndex AsOk() + { + this.ValidateTag(ApproveResultTag.Ok); + return (BlockIndex)this.Value!; + } + + public ApproveError AsErr() + { + this.ValidateTag(ApproveResultTag.Err); + return (ApproveError)this.Value!; + } + + private void ValidateTag(ApproveResultTag tag) + { + if (!this.Tag.Equals(tag)) + { + throw new InvalidOperationException($"Cannot cast '{this.Tag}' to type '{tag}'"); + } + } + } + + public enum ApproveResultTag + { + Ok, + Err + } +} \ No newline at end of file diff --git a/samples/Sample.Shared/ICRC1Ledger/Models/Burn.cs b/samples/Sample.Shared/ICRC1Ledger/Models/Burn.cs new file mode 100644 index 00000000..634db7b7 --- /dev/null +++ b/samples/Sample.Shared/ICRC1Ledger/Models/Burn.cs @@ -0,0 +1,39 @@ +using EdjCase.ICP.Candid.Mapping; +using Sample.Shared.ICRC1Ledger.Models; +using EdjCase.ICP.Candid.Models; +using System.Collections.Generic; +using Timestamp = System.UInt64; + +namespace Sample.Shared.ICRC1Ledger.Models +{ + public class Burn + { + [CandidName("from")] + public Account From { get; set; } + + [CandidName("memo")] + public OptionalValue> Memo { get; set; } + + [CandidName("created_at_time")] + public OptionalValue CreatedAtTime { get; set; } + + [CandidName("amount")] + public UnboundedUInt Amount { get; set; } + + [CandidName("spender")] + public OptionalValue Spender { get; set; } + + public Burn(Account from, OptionalValue> memo, OptionalValue createdAtTime, UnboundedUInt amount, OptionalValue spender) + { + this.From = from; + this.Memo = memo; + this.CreatedAtTime = createdAtTime; + this.Amount = amount; + this.Spender = spender; + } + + public Burn() + { + } + } +} \ No newline at end of file diff --git a/samples/Sample.Shared/ICRC1Ledger/Models/ChangeFeeCollector.cs b/samples/Sample.Shared/ICRC1Ledger/Models/ChangeFeeCollector.cs index eee7c158..deddac03 100644 --- a/samples/Sample.Shared/ICRC1Ledger/Models/ChangeFeeCollector.cs +++ b/samples/Sample.Shared/ICRC1Ledger/Models/ChangeFeeCollector.cs @@ -4,7 +4,7 @@ namespace Sample.Shared.ICRC1Ledger.Models { - [Variant(typeof(ChangeFeeCollectorTag))] + [Variant()] public class ChangeFeeCollector { [VariantTagProperty()] @@ -51,7 +51,6 @@ private void ValidateTag(ChangeFeeCollectorTag tag) public enum ChangeFeeCollectorTag { Unset, - [VariantOptionType(typeof(Account))] SetTo } } \ No newline at end of file diff --git a/samples/Sample.Shared/ICRC1Ledger/Models/FeatureFlags.cs b/samples/Sample.Shared/ICRC1Ledger/Models/FeatureFlags.cs new file mode 100644 index 00000000..8ef6e274 --- /dev/null +++ b/samples/Sample.Shared/ICRC1Ledger/Models/FeatureFlags.cs @@ -0,0 +1,19 @@ +using EdjCase.ICP.Candid.Mapping; + +namespace Sample.Shared.ICRC1Ledger.Models +{ + public class FeatureFlags + { + [CandidName("icrc2")] + public bool Icrc2 { get; set; } + + public FeatureFlags(bool icrc2) + { + this.Icrc2 = icrc2; + } + + public FeatureFlags() + { + } + } +} \ No newline at end of file diff --git a/samples/Sample.Shared/ICRC1Ledger/Models/HttpRequest.cs b/samples/Sample.Shared/ICRC1Ledger/Models/HttpRequest.cs new file mode 100644 index 00000000..4fa32fc4 --- /dev/null +++ b/samples/Sample.Shared/ICRC1Ledger/Models/HttpRequest.cs @@ -0,0 +1,32 @@ +using EdjCase.ICP.Candid.Mapping; +using System.Collections.Generic; + +namespace Sample.Shared.ICRC1Ledger.Models +{ + public class HttpRequest + { + [CandidName("url")] + public string Url { get; set; } + + [CandidName("method")] + public string Method { get; set; } + + [CandidName("body")] + public List Body { get; set; } + + [CandidName("headers")] + public Dictionary Headers { get; set; } + + public HttpRequest(string url, string method, List body, Dictionary headers) + { + this.Url = url; + this.Method = method; + this.Body = body; + this.Headers = headers; + } + + public HttpRequest() + { + } + } +} \ No newline at end of file diff --git a/samples/Sample.Shared/ICRC1Ledger/Models/HttpResponse.cs b/samples/Sample.Shared/ICRC1Ledger/Models/HttpResponse.cs new file mode 100644 index 00000000..25b0fa54 --- /dev/null +++ b/samples/Sample.Shared/ICRC1Ledger/Models/HttpResponse.cs @@ -0,0 +1,28 @@ +using EdjCase.ICP.Candid.Mapping; +using System.Collections.Generic; + +namespace Sample.Shared.ICRC1Ledger.Models +{ + public class HttpResponse + { + [CandidName("body")] + public List Body { get; set; } + + [CandidName("headers")] + public Dictionary Headers { get; set; } + + [CandidName("status_code")] + public ushort StatusCode { get; set; } + + public HttpResponse(List body, Dictionary headers, ushort statusCode) + { + this.Body = body; + this.Headers = headers; + this.StatusCode = statusCode; + } + + public HttpResponse() + { + } + } +} \ No newline at end of file diff --git a/samples/Sample.Shared/ICRC1Ledger/Models/InitArgs.cs b/samples/Sample.Shared/ICRC1Ledger/Models/InitArgs.cs index c09e86f1..db458f8a 100644 --- a/samples/Sample.Shared/ICRC1Ledger/Models/InitArgs.cs +++ b/samples/Sample.Shared/ICRC1Ledger/Models/InitArgs.cs @@ -14,7 +14,13 @@ public class InitArgs public OptionalValue FeeCollectorAccount { get; set; } [CandidName("transfer_fee")] - public ulong TransferFee { get; set; } + public UnboundedUInt TransferFee { get; set; } + + [CandidName("decimals")] + public OptionalValue Decimals { get; set; } + + [CandidName("max_memo_length")] + public OptionalValue MaxMemoLength { get; set; } [CandidName("token_symbol")] public string TokenSymbol { get; set; } @@ -23,23 +29,37 @@ public class InitArgs public string TokenName { get; set; } [CandidName("metadata")] - public List<(string, MetadataValue)> Metadata { get; set; } + public Dictionary Metadata { get; set; } [CandidName("initial_balances")] - public List<(Account, ulong)> InitialBalances { get; set; } + public Dictionary InitialBalances { get; set; } + + [CandidName("feature_flags")] + public OptionalValue FeatureFlags { get; set; } + + [CandidName("maximum_number_of_accounts")] + public OptionalValue MaximumNumberOfAccounts { get; set; } + + [CandidName("accounts_overflow_trim_quantity")] + public OptionalValue AccountsOverflowTrimQuantity { get; set; } [CandidName("archive_options")] public InitArgs.ArchiveOptionsInfo ArchiveOptions { get; set; } - public InitArgs(Account mintingAccount, OptionalValue feeCollectorAccount, ulong transferFee, string tokenSymbol, string tokenName, List<(string, MetadataValue)> metadata, List<(Account, ulong)> initialBalances, InitArgs.ArchiveOptionsInfo archiveOptions) + public InitArgs(Account mintingAccount, OptionalValue feeCollectorAccount, UnboundedUInt transferFee, OptionalValue decimals, OptionalValue maxMemoLength, string tokenSymbol, string tokenName, Dictionary metadata, Dictionary initialBalances, OptionalValue featureFlags, OptionalValue maximumNumberOfAccounts, OptionalValue accountsOverflowTrimQuantity, InitArgs.ArchiveOptionsInfo archiveOptions) { this.MintingAccount = mintingAccount; this.FeeCollectorAccount = feeCollectorAccount; this.TransferFee = transferFee; + this.Decimals = decimals; + this.MaxMemoLength = maxMemoLength; this.TokenSymbol = tokenSymbol; this.TokenName = tokenName; this.Metadata = metadata; this.InitialBalances = initialBalances; + this.FeatureFlags = featureFlags; + this.MaximumNumberOfAccounts = maximumNumberOfAccounts; + this.AccountsOverflowTrimQuantity = accountsOverflowTrimQuantity; this.ArchiveOptions = archiveOptions; } @@ -52,6 +72,9 @@ public class ArchiveOptionsInfo [CandidName("num_blocks_to_archive")] public ulong NumBlocksToArchive { get; set; } + [CandidName("max_transactions_per_response")] + public OptionalValue MaxTransactionsPerResponse { get; set; } + [CandidName("trigger_threshold")] public ulong TriggerThreshold { get; set; } @@ -67,9 +90,10 @@ public class ArchiveOptionsInfo [CandidName("controller_id")] public Principal ControllerId { get; set; } - public ArchiveOptionsInfo(ulong numBlocksToArchive, ulong triggerThreshold, OptionalValue maxMessageSizeBytes, OptionalValue cyclesForArchiveCreation, OptionalValue nodeMaxMemorySizeBytes, Principal controllerId) + public ArchiveOptionsInfo(ulong numBlocksToArchive, OptionalValue maxTransactionsPerResponse, ulong triggerThreshold, OptionalValue maxMessageSizeBytes, OptionalValue cyclesForArchiveCreation, OptionalValue nodeMaxMemorySizeBytes, Principal controllerId) { this.NumBlocksToArchive = numBlocksToArchive; + this.MaxTransactionsPerResponse = maxTransactionsPerResponse; this.TriggerThreshold = triggerThreshold; this.MaxMessageSizeBytes = maxMessageSizeBytes; this.CyclesForArchiveCreation = cyclesForArchiveCreation; diff --git a/samples/Sample.Shared/ICRC1Ledger/Models/LedgerArg.cs b/samples/Sample.Shared/ICRC1Ledger/Models/LedgerArg.cs index b95810b7..9945c6d5 100644 --- a/samples/Sample.Shared/ICRC1Ledger/Models/LedgerArg.cs +++ b/samples/Sample.Shared/ICRC1Ledger/Models/LedgerArg.cs @@ -5,7 +5,7 @@ namespace Sample.Shared.ICRC1Ledger.Models { - [Variant(typeof(LedgerArgTag))] + [Variant()] public class LedgerArg { [VariantTagProperty()] @@ -57,9 +57,7 @@ private void ValidateTag(LedgerArgTag tag) public enum LedgerArgTag { - [VariantOptionType(typeof(InitArgs))] Init, - [VariantOptionType(typeof(OptionalValue))] Upgrade } } \ No newline at end of file diff --git a/samples/Sample.Shared/ICRC1Ledger/Models/MetadataValue.cs b/samples/Sample.Shared/ICRC1Ledger/Models/MetadataValue.cs index f8bc73b7..4aabcdd6 100644 --- a/samples/Sample.Shared/ICRC1Ledger/Models/MetadataValue.cs +++ b/samples/Sample.Shared/ICRC1Ledger/Models/MetadataValue.cs @@ -6,7 +6,7 @@ namespace Sample.Shared.ICRC1Ledger.Models { - [Variant(typeof(MetadataValueTag))] + [Variant()] public class MetadataValue { [VariantTagProperty()] @@ -80,13 +80,9 @@ private void ValidateTag(MetadataValueTag tag) public enum MetadataValueTag { - [VariantOptionType(typeof(UnboundedUInt))] Nat, - [VariantOptionType(typeof(UnboundedInt))] Int, - [VariantOptionType(typeof(string))] Text, - [VariantOptionType(typeof(List))] Blob } } \ No newline at end of file diff --git a/samples/Sample.Shared/ICRC1Ledger/Models/Mint.cs b/samples/Sample.Shared/ICRC1Ledger/Models/Mint.cs new file mode 100644 index 00000000..ce9c09b6 --- /dev/null +++ b/samples/Sample.Shared/ICRC1Ledger/Models/Mint.cs @@ -0,0 +1,35 @@ +using EdjCase.ICP.Candid.Mapping; +using Sample.Shared.ICRC1Ledger.Models; +using EdjCase.ICP.Candid.Models; +using System.Collections.Generic; +using Timestamp = System.UInt64; + +namespace Sample.Shared.ICRC1Ledger.Models +{ + public class Mint + { + [CandidName("to")] + public Account To { get; set; } + + [CandidName("memo")] + public OptionalValue> Memo { get; set; } + + [CandidName("created_at_time")] + public OptionalValue CreatedAtTime { get; set; } + + [CandidName("amount")] + public UnboundedUInt Amount { get; set; } + + public Mint(Account to, OptionalValue> memo, OptionalValue createdAtTime, UnboundedUInt amount) + { + this.To = to; + this.Memo = memo; + this.CreatedAtTime = createdAtTime; + this.Amount = amount; + } + + public Mint() + { + } + } +} \ No newline at end of file diff --git a/samples/Sample.Shared/ICRC1Ledger/Models/StandardRecord.cs b/samples/Sample.Shared/ICRC1Ledger/Models/StandardRecord.cs new file mode 100644 index 00000000..f6da1df8 --- /dev/null +++ b/samples/Sample.Shared/ICRC1Ledger/Models/StandardRecord.cs @@ -0,0 +1,23 @@ +using EdjCase.ICP.Candid.Mapping; + +namespace Sample.Shared.ICRC1Ledger.Models +{ + public class StandardRecord + { + [CandidName("url")] + public string Url { get; set; } + + [CandidName("name")] + public string Name { get; set; } + + public StandardRecord(string url, string name) + { + this.Url = url; + this.Name = name; + } + + public StandardRecord() + { + } + } +} \ No newline at end of file diff --git a/samples/Sample.Shared/ICRC1Ledger/Models/Transaction.cs b/samples/Sample.Shared/ICRC1Ledger/Models/Transaction.cs index be04dfc9..252fb72e 100644 --- a/samples/Sample.Shared/ICRC1Ledger/Models/Transaction.cs +++ b/samples/Sample.Shared/ICRC1Ledger/Models/Transaction.cs @@ -1,128 +1,42 @@ using EdjCase.ICP.Candid.Mapping; using EdjCase.ICP.Candid.Models; using Sample.Shared.ICRC1Ledger.Models; -using System.Collections.Generic; using Timestamp = System.UInt64; namespace Sample.Shared.ICRC1Ledger.Models { public class Transaction { + [CandidName("burn")] + public OptionalValue Burn { get; set; } + [CandidName("kind")] public string Kind { get; set; } [CandidName("mint")] - public OptionalValue Mint { get; set; } + public OptionalValue Mint { get; set; } - [CandidName("burn")] - public OptionalValue Burn { get; set; } - - [CandidName("transfer")] - public OptionalValue Transfer { get; set; } + [CandidName("approve")] + public OptionalValue Approve { get; set; } [CandidName("timestamp")] - public ulong Timestamp { get; set; } + public Timestamp Timestamp { get; set; } - public Transaction(string kind, OptionalValue mint, OptionalValue burn, OptionalValue transfer, ulong timestamp) + [CandidName("transfer")] + public OptionalValue Transfer { get; set; } + + public Transaction(OptionalValue burn, string kind, OptionalValue mint, OptionalValue approve, Timestamp timestamp, OptionalValue transfer) { + this.Burn = burn; this.Kind = kind; this.Mint = mint; - this.Burn = burn; - this.Transfer = transfer; + this.Approve = approve; this.Timestamp = timestamp; + this.Transfer = transfer; } public Transaction() { } - - public class MintValue - { - [CandidName("amount")] - public UnboundedUInt Amount { get; set; } - - [CandidName("to")] - public Account To { get; set; } - - [CandidName("memo")] - public OptionalValue> Memo { get; set; } - - [CandidName("created_at_time")] - public OptionalValue CreatedAtTime { get; set; } - - public MintValue(UnboundedUInt amount, Account to, OptionalValue> memo, OptionalValue createdAtTime) - { - this.Amount = amount; - this.To = to; - this.Memo = memo; - this.CreatedAtTime = createdAtTime; - } - - public MintValue() - { - } - } - - public class BurnValue - { - [CandidName("amount")] - public UnboundedUInt Amount { get; set; } - - [CandidName("from")] - public Account From { get; set; } - - [CandidName("memo")] - public OptionalValue> Memo { get; set; } - - [CandidName("created_at_time")] - public OptionalValue CreatedAtTime { get; set; } - - public BurnValue(UnboundedUInt amount, Account from, OptionalValue> memo, OptionalValue createdAtTime) - { - this.Amount = amount; - this.From = from; - this.Memo = memo; - this.CreatedAtTime = createdAtTime; - } - - public BurnValue() - { - } - } - - public class TransferValue - { - [CandidName("amount")] - public UnboundedUInt Amount { get; set; } - - [CandidName("from")] - public Account From { get; set; } - - [CandidName("to")] - public Account To { get; set; } - - [CandidName("memo")] - public OptionalValue> Memo { get; set; } - - [CandidName("created_at_time")] - public OptionalValue CreatedAtTime { get; set; } - - [CandidName("fee")] - public OptionalValue Fee { get; set; } - - public TransferValue(UnboundedUInt amount, Account from, Account to, OptionalValue> memo, OptionalValue createdAtTime, OptionalValue fee) - { - this.Amount = amount; - this.From = from; - this.To = to; - this.Memo = memo; - this.CreatedAtTime = createdAtTime; - this.Fee = fee; - } - - public TransferValue() - { - } - } } } \ No newline at end of file diff --git a/samples/Sample.Shared/ICRC1Ledger/Models/Transfer.cs b/samples/Sample.Shared/ICRC1Ledger/Models/Transfer.cs new file mode 100644 index 00000000..e6a65b54 --- /dev/null +++ b/samples/Sample.Shared/ICRC1Ledger/Models/Transfer.cs @@ -0,0 +1,47 @@ +using EdjCase.ICP.Candid.Mapping; +using Sample.Shared.ICRC1Ledger.Models; +using EdjCase.ICP.Candid.Models; +using System.Collections.Generic; +using Timestamp = System.UInt64; + +namespace Sample.Shared.ICRC1Ledger.Models +{ + public class Transfer + { + [CandidName("to")] + public Account To { get; set; } + + [CandidName("fee")] + public OptionalValue Fee { get; set; } + + [CandidName("from")] + public Account From { get; set; } + + [CandidName("memo")] + public OptionalValue> Memo { get; set; } + + [CandidName("created_at_time")] + public OptionalValue CreatedAtTime { get; set; } + + [CandidName("amount")] + public UnboundedUInt Amount { get; set; } + + [CandidName("spender")] + public OptionalValue Spender { get; set; } + + public Transfer(Account to, OptionalValue fee, Account from, OptionalValue> memo, OptionalValue createdAtTime, UnboundedUInt amount, OptionalValue spender) + { + this.To = to; + this.Fee = fee; + this.From = from; + this.Memo = memo; + this.CreatedAtTime = createdAtTime; + this.Amount = amount; + this.Spender = spender; + } + + public Transfer() + { + } + } +} \ No newline at end of file diff --git a/samples/Sample.Shared/ICRC1Ledger/Models/TransferError.cs b/samples/Sample.Shared/ICRC1Ledger/Models/TransferError.cs index de52303f..2ed753c7 100644 --- a/samples/Sample.Shared/ICRC1Ledger/Models/TransferError.cs +++ b/samples/Sample.Shared/ICRC1Ledger/Models/TransferError.cs @@ -3,11 +3,12 @@ using System; using EdjCase.ICP.Candid.Models; using BlockIndex = EdjCase.ICP.Candid.Models.UnboundedUInt; +using Timestamp = System.UInt64; using Tokens = EdjCase.ICP.Candid.Models.UnboundedUInt; namespace Sample.Shared.ICRC1Ledger.Models { - [Variant(typeof(TransferErrorTag))] + [Variant()] public class TransferError { [VariantTagProperty()] @@ -158,9 +159,9 @@ public InsufficientFundsInfo() public class CreatedInFutureInfo { [CandidName("ledger_time")] - public ulong LedgerTime { get; set; } + public Timestamp LedgerTime { get; set; } - public CreatedInFutureInfo(ulong ledgerTime) + public CreatedInFutureInfo(Timestamp ledgerTime) { this.LedgerTime = ledgerTime; } @@ -207,19 +208,13 @@ public GenericErrorInfo() public enum TransferErrorTag { - [VariantOptionType(typeof(TransferError.BadFeeInfo))] BadFee, - [VariantOptionType(typeof(TransferError.BadBurnInfo))] BadBurn, - [VariantOptionType(typeof(TransferError.InsufficientFundsInfo))] InsufficientFunds, TooOld, - [VariantOptionType(typeof(TransferError.CreatedInFutureInfo))] CreatedInFuture, TemporarilyUnavailable, - [VariantOptionType(typeof(TransferError.DuplicateInfo))] Duplicate, - [VariantOptionType(typeof(TransferError.GenericErrorInfo))] GenericError } } \ No newline at end of file diff --git a/samples/Sample.Shared/ICRC1Ledger/Models/TransferFromArgs.cs b/samples/Sample.Shared/ICRC1Ledger/Models/TransferFromArgs.cs new file mode 100644 index 00000000..1236cc33 --- /dev/null +++ b/samples/Sample.Shared/ICRC1Ledger/Models/TransferFromArgs.cs @@ -0,0 +1,49 @@ +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Sample.Shared.ICRC1Ledger.Models; +using System.Collections.Generic; +using Subaccount = System.Collections.Generic.List; +using Timestamp = System.UInt64; +using Tokens = EdjCase.ICP.Candid.Models.UnboundedUInt; + +namespace Sample.Shared.ICRC1Ledger.Models +{ + public class TransferFromArgs + { + [CandidName("spender_subaccount")] + public OptionalValue SpenderSubaccount { get; set; } + + [CandidName("from")] + public Account From { get; set; } + + [CandidName("to")] + public Account To { get; set; } + + [CandidName("amount")] + public Tokens Amount { get; set; } + + [CandidName("fee")] + public OptionalValue Fee { get; set; } + + [CandidName("memo")] + public OptionalValue> Memo { get; set; } + + [CandidName("created_at_time")] + public OptionalValue CreatedAtTime { get; set; } + + public TransferFromArgs(OptionalValue spenderSubaccount, Account from, Account to, Tokens amount, OptionalValue fee, OptionalValue> memo, OptionalValue createdAtTime) + { + this.SpenderSubaccount = spenderSubaccount; + this.From = from; + this.To = to; + this.Amount = amount; + this.Fee = fee; + this.Memo = memo; + this.CreatedAtTime = createdAtTime; + } + + public TransferFromArgs() + { + } + } +} \ No newline at end of file diff --git a/samples/Sample.Shared/ICRC1Ledger/Models/TransferFromError.cs b/samples/Sample.Shared/ICRC1Ledger/Models/TransferFromError.cs new file mode 100644 index 00000000..04f193d4 --- /dev/null +++ b/samples/Sample.Shared/ICRC1Ledger/Models/TransferFromError.cs @@ -0,0 +1,247 @@ +using EdjCase.ICP.Candid.Mapping; +using Sample.Shared.ICRC1Ledger.Models; +using System; +using EdjCase.ICP.Candid.Models; +using BlockIndex = EdjCase.ICP.Candid.Models.UnboundedUInt; +using Timestamp = System.UInt64; +using Tokens = EdjCase.ICP.Candid.Models.UnboundedUInt; + +namespace Sample.Shared.ICRC1Ledger.Models +{ + [Variant()] + public class TransferFromError + { + [VariantTagProperty()] + public TransferFromErrorTag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public TransferFromError(TransferFromErrorTag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected TransferFromError() + { + } + + public static TransferFromError BadFee(TransferFromError.BadFeeInfo info) + { + return new TransferFromError(TransferFromErrorTag.BadFee, info); + } + + public static TransferFromError BadBurn(TransferFromError.BadBurnInfo info) + { + return new TransferFromError(TransferFromErrorTag.BadBurn, info); + } + + public static TransferFromError InsufficientFunds(TransferFromError.InsufficientFundsInfo info) + { + return new TransferFromError(TransferFromErrorTag.InsufficientFunds, info); + } + + public static TransferFromError InsufficientAllowance(TransferFromError.InsufficientAllowanceInfo info) + { + return new TransferFromError(TransferFromErrorTag.InsufficientAllowance, info); + } + + public static TransferFromError TooOld() + { + return new TransferFromError(TransferFromErrorTag.TooOld, null); + } + + public static TransferFromError CreatedInFuture(TransferFromError.CreatedInFutureInfo info) + { + return new TransferFromError(TransferFromErrorTag.CreatedInFuture, info); + } + + public static TransferFromError Duplicate(TransferFromError.DuplicateInfo info) + { + return new TransferFromError(TransferFromErrorTag.Duplicate, info); + } + + public static TransferFromError TemporarilyUnavailable() + { + return new TransferFromError(TransferFromErrorTag.TemporarilyUnavailable, null); + } + + public static TransferFromError GenericError(TransferFromError.GenericErrorInfo info) + { + return new TransferFromError(TransferFromErrorTag.GenericError, info); + } + + public TransferFromError.BadFeeInfo AsBadFee() + { + this.ValidateTag(TransferFromErrorTag.BadFee); + return (TransferFromError.BadFeeInfo)this.Value!; + } + + public TransferFromError.BadBurnInfo AsBadBurn() + { + this.ValidateTag(TransferFromErrorTag.BadBurn); + return (TransferFromError.BadBurnInfo)this.Value!; + } + + public TransferFromError.InsufficientFundsInfo AsInsufficientFunds() + { + this.ValidateTag(TransferFromErrorTag.InsufficientFunds); + return (TransferFromError.InsufficientFundsInfo)this.Value!; + } + + public TransferFromError.InsufficientAllowanceInfo AsInsufficientAllowance() + { + this.ValidateTag(TransferFromErrorTag.InsufficientAllowance); + return (TransferFromError.InsufficientAllowanceInfo)this.Value!; + } + + public TransferFromError.CreatedInFutureInfo AsCreatedInFuture() + { + this.ValidateTag(TransferFromErrorTag.CreatedInFuture); + return (TransferFromError.CreatedInFutureInfo)this.Value!; + } + + public TransferFromError.DuplicateInfo AsDuplicate() + { + this.ValidateTag(TransferFromErrorTag.Duplicate); + return (TransferFromError.DuplicateInfo)this.Value!; + } + + public TransferFromError.GenericErrorInfo AsGenericError() + { + this.ValidateTag(TransferFromErrorTag.GenericError); + return (TransferFromError.GenericErrorInfo)this.Value!; + } + + private void ValidateTag(TransferFromErrorTag tag) + { + if (!this.Tag.Equals(tag)) + { + throw new InvalidOperationException($"Cannot cast '{this.Tag}' to type '{tag}'"); + } + } + + public class BadFeeInfo + { + [CandidName("expected_fee")] + public Tokens ExpectedFee { get; set; } + + public BadFeeInfo(Tokens expectedFee) + { + this.ExpectedFee = expectedFee; + } + + public BadFeeInfo() + { + } + } + + public class BadBurnInfo + { + [CandidName("min_burn_amount")] + public Tokens MinBurnAmount { get; set; } + + public BadBurnInfo(Tokens minBurnAmount) + { + this.MinBurnAmount = minBurnAmount; + } + + public BadBurnInfo() + { + } + } + + public class InsufficientFundsInfo + { + [CandidName("balance")] + public Tokens Balance { get; set; } + + public InsufficientFundsInfo(Tokens balance) + { + this.Balance = balance; + } + + public InsufficientFundsInfo() + { + } + } + + public class InsufficientAllowanceInfo + { + [CandidName("allowance")] + public Tokens Allowance { get; set; } + + public InsufficientAllowanceInfo(Tokens allowance) + { + this.Allowance = allowance; + } + + public InsufficientAllowanceInfo() + { + } + } + + public class CreatedInFutureInfo + { + [CandidName("ledger_time")] + public Timestamp LedgerTime { get; set; } + + public CreatedInFutureInfo(Timestamp ledgerTime) + { + this.LedgerTime = ledgerTime; + } + + public CreatedInFutureInfo() + { + } + } + + public class DuplicateInfo + { + [CandidName("duplicate_of")] + public BlockIndex DuplicateOf { get; set; } + + public DuplicateInfo(BlockIndex duplicateOf) + { + this.DuplicateOf = duplicateOf; + } + + public DuplicateInfo() + { + } + } + + public class GenericErrorInfo + { + [CandidName("error_code")] + public UnboundedUInt ErrorCode { get; set; } + + [CandidName("message")] + public string Message { get; set; } + + public GenericErrorInfo(UnboundedUInt errorCode, string message) + { + this.ErrorCode = errorCode; + this.Message = message; + } + + public GenericErrorInfo() + { + } + } + } + + public enum TransferFromErrorTag + { + BadFee, + BadBurn, + InsufficientFunds, + InsufficientAllowance, + TooOld, + CreatedInFuture, + Duplicate, + TemporarilyUnavailable, + GenericError + } +} \ No newline at end of file diff --git a/samples/Sample.Shared/ICRC1Ledger/Models/TransferFromResult.cs b/samples/Sample.Shared/ICRC1Ledger/Models/TransferFromResult.cs new file mode 100644 index 00000000..2fab0fc0 --- /dev/null +++ b/samples/Sample.Shared/ICRC1Ledger/Models/TransferFromResult.cs @@ -0,0 +1,63 @@ +using EdjCase.ICP.Candid.Mapping; +using Sample.Shared.ICRC1Ledger.Models; +using System; +using BlockIndex = EdjCase.ICP.Candid.Models.UnboundedUInt; + +namespace Sample.Shared.ICRC1Ledger.Models +{ + [Variant()] + public class TransferFromResult + { + [VariantTagProperty()] + public TransferFromResultTag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public TransferFromResult(TransferFromResultTag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected TransferFromResult() + { + } + + public static TransferFromResult Ok(BlockIndex info) + { + return new TransferFromResult(TransferFromResultTag.Ok, info); + } + + public static TransferFromResult Err(TransferFromError info) + { + return new TransferFromResult(TransferFromResultTag.Err, info); + } + + public BlockIndex AsOk() + { + this.ValidateTag(TransferFromResultTag.Ok); + return (BlockIndex)this.Value!; + } + + public TransferFromError AsErr() + { + this.ValidateTag(TransferFromResultTag.Err); + return (TransferFromError)this.Value!; + } + + private void ValidateTag(TransferFromResultTag tag) + { + if (!this.Tag.Equals(tag)) + { + throw new InvalidOperationException($"Cannot cast '{this.Tag}' to type '{tag}'"); + } + } + } + + public enum TransferFromResultTag + { + Ok, + Err + } +} \ No newline at end of file diff --git a/samples/Sample.Shared/ICRC1Ledger/Models/TransferResult.cs b/samples/Sample.Shared/ICRC1Ledger/Models/TransferResult.cs index f8a83732..dd528fc0 100644 --- a/samples/Sample.Shared/ICRC1Ledger/Models/TransferResult.cs +++ b/samples/Sample.Shared/ICRC1Ledger/Models/TransferResult.cs @@ -5,7 +5,7 @@ namespace Sample.Shared.ICRC1Ledger.Models { - [Variant(typeof(TransferResultTag))] + [Variant()] public class TransferResult { [VariantTagProperty()] @@ -57,9 +57,7 @@ private void ValidateTag(TransferResultTag tag) public enum TransferResultTag { - [VariantOptionType(typeof(BlockIndex))] Ok, - [VariantOptionType(typeof(TransferError))] Err } } \ No newline at end of file diff --git a/samples/Sample.Shared/ICRC1Ledger/Models/UpgradeArgs.cs b/samples/Sample.Shared/ICRC1Ledger/Models/UpgradeArgs.cs index de2d6107..7ce67ec9 100644 --- a/samples/Sample.Shared/ICRC1Ledger/Models/UpgradeArgs.cs +++ b/samples/Sample.Shared/ICRC1Ledger/Models/UpgradeArgs.cs @@ -8,7 +8,7 @@ namespace Sample.Shared.ICRC1Ledger.Models public class UpgradeArgs { [CandidName("metadata")] - public OptionalValue> Metadata { get; set; } + public OptionalValue> Metadata { get; set; } [CandidName("token_symbol")] public OptionalValue TokenSymbol { get; set; } @@ -17,7 +17,7 @@ public class UpgradeArgs public OptionalValue TokenName { get; set; } [CandidName("transfer_fee")] - public OptionalValue TransferFee { get; set; } + public OptionalValue TransferFee { get; set; } [CandidName("change_fee_collector")] public OptionalValue ChangeFeeCollector { get; set; } @@ -25,7 +25,16 @@ public class UpgradeArgs [CandidName("max_memo_length")] public OptionalValue MaxMemoLength { get; set; } - public UpgradeArgs(OptionalValue> metadata, OptionalValue tokenSymbol, OptionalValue tokenName, OptionalValue transferFee, OptionalValue changeFeeCollector, OptionalValue maxMemoLength) + [CandidName("feature_flags")] + public OptionalValue FeatureFlags { get; set; } + + [CandidName("maximum_number_of_accounts")] + public OptionalValue MaximumNumberOfAccounts { get; set; } + + [CandidName("accounts_overflow_trim_quantity")] + public OptionalValue AccountsOverflowTrimQuantity { get; set; } + + public UpgradeArgs(OptionalValue> metadata, OptionalValue tokenSymbol, OptionalValue tokenName, OptionalValue transferFee, OptionalValue changeFeeCollector, OptionalValue maxMemoLength, OptionalValue featureFlags, OptionalValue maximumNumberOfAccounts, OptionalValue accountsOverflowTrimQuantity) { this.Metadata = metadata; this.TokenSymbol = tokenSymbol; @@ -33,6 +42,9 @@ public UpgradeArgs(OptionalValue> metadata, Option this.TransferFee = transferFee; this.ChangeFeeCollector = changeFeeCollector; this.MaxMemoLength = maxMemoLength; + this.FeatureFlags = featureFlags; + this.MaximumNumberOfAccounts = maximumNumberOfAccounts; + this.AccountsOverflowTrimQuantity = accountsOverflowTrimQuantity; } public UpgradeArgs() diff --git a/samples/Sample.Shared/ICRC1Ledger/Models/Value.cs b/samples/Sample.Shared/ICRC1Ledger/Models/Value.cs index a283f459..8aca17d0 100644 --- a/samples/Sample.Shared/ICRC1Ledger/Models/Value.cs +++ b/samples/Sample.Shared/ICRC1Ledger/Models/Value.cs @@ -3,11 +3,11 @@ using System.Collections.Generic; using EdjCase.ICP.Candid.Models; using System; -using Map = System.Collections.Generic.List>; +using Map = System.Collections.Generic.Dictionary; namespace Sample.Shared.ICRC1Ledger.Models { - [Variant(typeof(ValueTag))] + [Variant()] public class Value { [VariantTagProperty()] @@ -114,19 +114,12 @@ private void ValidateTag(ValueTag tag) public enum ValueTag { - [VariantOptionType(typeof(List))] Blob, - [VariantOptionType(typeof(string))] Text, - [VariantOptionType(typeof(UnboundedUInt))] Nat, - [VariantOptionType(typeof(ulong))] Nat64, - [VariantOptionType(typeof(UnboundedInt))] Int, - [VariantOptionType(typeof(List))] Array, - [VariantOptionType(typeof(Map))] Map } } \ No newline at end of file diff --git a/samples/Sample.Shared/candid-client.toml b/samples/Sample.Shared/candid-client.toml index 0332eb74..314dbd1c 100644 --- a/samples/Sample.Shared/candid-client.toml +++ b/samples/Sample.Shared/candid-client.toml @@ -7,6 +7,7 @@ feature-nullable = true name = "Dex" type = "file" file-path = "ServiceDefinitions/Dex.did" +variants-use-properties = true [[clients]] name = "ICRC1Ledger" @@ -25,15 +26,18 @@ keep-candid-case = true name = "Governance" type = "canister" canister-id = "rrkah-fqaaa-aaaaa-aaaaq-cai" -[clients.types.AccountIdentifier] -type = "record" +[clients.types.AccountIdentifier] name = "AccountId" -[clients.types.AccountIdentifier.fields.hash] -type = "vec" -name = "Hazh" +[clients.types.AccountIdentifier.fields.hash] representation = "Array" -[clients.types.Governance] -type = "record" -[clients.types.Governance.fields.default_followees] -type = "vec" -representation = "Dictionary" \ No newline at end of file + +[clients.types.Governance.fields.default_followees] +representation = "List" + + +[clients.types.Action.fields.RegisterKnownNeuron] +name = "RegisterNeuron" # Rename RegisterKnownNeuron -> RegisterNeuron +[clients.types.Action.fields.RegisterKnownNeuron.fields.id] +name = "ID" +[clients.types.Action.fields.RegisterKnownNeuron.fields.id.innerType.fields.id] +name = "ID" \ No newline at end of file diff --git a/src/Agent/Standards/ICRC1/Models/MetaDataValue.cs b/src/Agent/Standards/ICRC1/Models/MetaDataValue.cs index 0c9d884d..aa6638a8 100644 --- a/src/Agent/Standards/ICRC1/Models/MetaDataValue.cs +++ b/src/Agent/Standards/ICRC1/Models/MetaDataValue.cs @@ -37,7 +37,7 @@ public MetaData(string key, MetaDataValue value) /// /// A model representing the metadata value from an icrc1 token /// - [Variant(typeof(MetaDataValueTag))] + [Variant] public class MetaDataValue { /// @@ -163,22 +163,18 @@ public enum MetaDataValueTag /// /// Nat value /// - [VariantOptionType(typeof(UnboundedUInt))] Nat, /// /// Int value /// - [VariantOptionType(typeof(UnboundedInt))] Int, /// /// Text value /// - [VariantOptionType(typeof(string))] Text, /// /// Blob value /// - [VariantOptionType(typeof(byte[]))] Blob, } } \ No newline at end of file diff --git a/src/Agent/Standards/ICRC1/Models/TransferError.cs b/src/Agent/Standards/ICRC1/Models/TransferError.cs index a5ebe398..d1d3c096 100644 --- a/src/Agent/Standards/ICRC1/Models/TransferError.cs +++ b/src/Agent/Standards/ICRC1/Models/TransferError.cs @@ -8,7 +8,7 @@ namespace EdjCase.ICP.Agent.Standards.ICRC1.Models /// /// This class represents an error that can occur during a transfer /// - [Variant(typeof(TransferErrorTag))] + [Variant] public class TransferError { /// @@ -327,19 +327,16 @@ public enum TransferErrorTag /// /// Indicates an error due to an incorrect fee /// - [VariantOptionType(typeof(BadFeeError))] BadFee, /// /// Indicates an error due to an incorrect burn amount /// - [VariantOptionType(typeof(BadBurnError))] BadBurn, /// /// Indicates an error due to insufficient funds for the transaction /// - [VariantOptionType(typeof(InsufficientFundsError))] InsufficientFunds, /// @@ -350,13 +347,11 @@ public enum TransferErrorTag /// /// Indicates an error due to a transaction being created in the future /// - [VariantOptionType(typeof(CreatedInFutureError))] CreatedInFuture, /// /// Indicates an error due to a transaction being a duplicate /// - [VariantOptionType(typeof(DuplicateError))] Duplicate, /// @@ -367,7 +362,6 @@ public enum TransferErrorTag /// /// Indicates a generic error that can occur during a transfer /// - [VariantOptionType(typeof(GenericError))] GenericError } } \ No newline at end of file diff --git a/src/Agent/Standards/ICRC1/Models/TransferResult.cs b/src/Agent/Standards/ICRC1/Models/TransferResult.cs index 5368de0c..a735acbd 100644 --- a/src/Agent/Standards/ICRC1/Models/TransferResult.cs +++ b/src/Agent/Standards/ICRC1/Models/TransferResult.cs @@ -8,7 +8,7 @@ namespace EdjCase.ICP.Agent.Standards.ICRC1.Models /// /// Represents the result of a transfer operation, which can either be Ok with a value or Err with an error object /// - [Variant(typeof(TransferResultTag))] + [Variant] public class TransferResult { /// @@ -96,12 +96,10 @@ public enum TransferResultTag /// /// Indicates a successful transfer operation with the associated UnboundedUInt value /// - [VariantOptionType(typeof(UnboundedUInt))] Ok, /// /// Indicates a failed transfer operation with the associated TransferError object containing information about the error /// - [VariantOptionType(typeof(TransferError))] Err } diff --git a/src/Candid/API.md b/src/Candid/API.md index a2e2579e..a9e94214 100644 --- a/src/Candid/API.md +++ b/src/Candid/API.md @@ -683,11 +683,10 @@ - [UnboundedUIntExtensions](#T-EdjCase-ICP-Candid-Models-UnboundedUIntExtensions 'EdjCase.ICP.Candid.Models.UnboundedUIntExtensions') - [ToUnbounded(value)](#M-EdjCase-ICP-Candid-Models-UnboundedUIntExtensions-ToUnbounded-System-UInt64- 'EdjCase.ICP.Candid.Models.UnboundedUIntExtensions.ToUnbounded(System.UInt64)') - [VariantAttribute](#T-EdjCase-ICP-Candid-Mapping-VariantAttribute 'EdjCase.ICP.Candid.Mapping.VariantAttribute') - - [#ctor(enumType)](#M-EdjCase-ICP-Candid-Mapping-VariantAttribute-#ctor-System-Type- 'EdjCase.ICP.Candid.Mapping.VariantAttribute.#ctor(System.Type)') - - [TagType](#P-EdjCase-ICP-Candid-Mapping-VariantAttribute-TagType 'EdjCase.ICP.Candid.Mapping.VariantAttribute.TagType') -- [VariantOptionTypeAttribute](#T-EdjCase-ICP-Candid-Mapping-VariantOptionTypeAttribute 'EdjCase.ICP.Candid.Mapping.VariantOptionTypeAttribute') - - [#ctor(optionType)](#M-EdjCase-ICP-Candid-Mapping-VariantOptionTypeAttribute-#ctor-System-Type- 'EdjCase.ICP.Candid.Mapping.VariantOptionTypeAttribute.#ctor(System.Type)') - - [OptionType](#P-EdjCase-ICP-Candid-Mapping-VariantOptionTypeAttribute-OptionType 'EdjCase.ICP.Candid.Mapping.VariantOptionTypeAttribute.OptionType') +- [VariantOptionAttribute](#T-EdjCase-ICP-Candid-Mapping-VariantOptionAttribute 'EdjCase.ICP.Candid.Mapping.VariantOptionAttribute') + - [#ctor(tag)](#M-EdjCase-ICP-Candid-Mapping-VariantOptionAttribute-#ctor-EdjCase-ICP-Candid-Models-CandidTag- 'EdjCase.ICP.Candid.Mapping.VariantOptionAttribute.#ctor(EdjCase.ICP.Candid.Models.CandidTag)') + - [#ctor(tag)](#M-EdjCase-ICP-Candid-Mapping-VariantOptionAttribute-#ctor-System-String- 'EdjCase.ICP.Candid.Mapping.VariantOptionAttribute.#ctor(System.String)') + - [Tag](#P-EdjCase-ICP-Candid-Mapping-VariantOptionAttribute-Tag 'EdjCase.ICP.Candid.Mapping.VariantOptionAttribute.Tag') - [VariantTagPropertyAttribute](#T-EdjCase-ICP-Candid-Mapping-VariantTagPropertyAttribute 'EdjCase.ICP.Candid.Mapping.VariantTagPropertyAttribute') - [VariantValuePropertyAttribute](#T-EdjCase-ICP-Candid-Mapping-VariantValuePropertyAttribute 'EdjCase.ICP.Candid.Mapping.VariantValuePropertyAttribute') @@ -9195,30 +9194,8 @@ An attribute to put on a class to identify it as a variant type for serializatio Requires the use of \`VariantTagPropertyAttribute\`, \`VariantOptionTypeAttribute\` and \`VariantValuePropertyAttribute\` attributes if used - -### #ctor(enumType) `constructor` - -##### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| enumType | [System.Type](http://msdn.microsoft.com/query/dev14.query?appId=Dev14IDEF1&l=EN-US&k=k:System.Type 'System.Type') | The enum type to use for specifying the tags of the variant | - -##### Exceptions - -| Name | Description | -| ---- | ----------- | -| [System.ArgumentException](http://msdn.microsoft.com/query/dev14.query?appId=Dev14IDEF1&l=EN-US&k=k:System.ArgumentException 'System.ArgumentException') | Throws if the type is not an enum | - - -### TagType `property` - -##### Summary - -The enum type to use for specifying the tags of the variant - - -## VariantOptionTypeAttribute `type` + +## VariantOptionAttribute `type` ##### Namespace @@ -9229,17 +9206,26 @@ EdjCase.ICP.Candid.Mapping An attribute to put on an enum option to specify if the tag has an attached value in the variant, otherwise the attached type will be null - -### #ctor(optionType) `constructor` + +### #ctor(tag) `constructor` + +##### Parameters + +| Name | Type | Description | +| ---- | ---- | ----------- | +| tag | [EdjCase.ICP.Candid.Models.CandidTag](#T-EdjCase-ICP-Candid-Models-CandidTag 'EdjCase.ICP.Candid.Models.CandidTag') | The tag of the variant option | + + +### #ctor(tag) `constructor` ##### Parameters | Name | Type | Description | | ---- | ---- | ----------- | -| optionType | [System.Type](http://msdn.microsoft.com/query/dev14.query?appId=Dev14IDEF1&l=EN-US&k=k:System.Type 'System.Type') | The type of the variant option value to use | +| tag | [System.String](http://msdn.microsoft.com/query/dev14.query?appId=Dev14IDEF1&l=EN-US&k=k:System.String 'System.String') | The tag of the variant option | - -### OptionType `property` + +### Tag `property` ##### Summary diff --git a/src/Candid/API.xml b/src/Candid/API.xml index 827937bf..6bef96f2 100644 --- a/src/Candid/API.xml +++ b/src/Candid/API.xml @@ -465,15 +465,6 @@ `VariantValuePropertyAttribute` attributes if used - - - The enum type to use for specifying the tags of the variant - - - - The enum type to use for specifying the tags of the variant - Throws if the type is not an enum - An attribute to put on a property/field that indicates where to hold the @@ -486,19 +477,22 @@ tag value object. The type must be compatible with all value types, recommend using `object?` - + An attribute to put on an enum option to specify if the tag has an attached value in the variant, otherwise the attached type will be null - + The type of the variant option value to use - - The type of the variant option value to use + + The tag of the variant option + + + The tag of the variant option diff --git a/src/Candid/Mapping/IResolvableTypeInfo.cs b/src/Candid/Mapping/IResolvableTypeInfo.cs index e4851feb..c5365613 100644 --- a/src/Candid/Mapping/IResolvableTypeInfo.cs +++ b/src/Candid/Mapping/IResolvableTypeInfo.cs @@ -6,6 +6,7 @@ using System; using System.Collections; using System.Collections.Generic; +using System.Data; using System.Linq; using System.Reflection; @@ -437,37 +438,14 @@ private static IResolvableTypeInfo BuildEnumVariant(Type enumType) private static IResolvableTypeInfo BuildVariant(Type objType, VariantAttribute attribute) { - object? variant = Activator.CreateInstance(objType, nonPublic: true); - - Dictionary options = attribute.TagType.GetEnumValues() - .Cast() - .Select(tagEnum => - { - string tagName = Enum.GetName(attribute.TagType, tagEnum); - MemberInfo field = attribute.TagType.GetMember(tagName).First(); - var typeAttribute = field.GetCustomAttribute(); - Type? optionType = typeAttribute?.OptionType; - var tagAttribute = field.GetCustomAttribute(); - CandidTag tag = tagAttribute?.Tag ?? CandidTag.FromName(tagName); - return (tag, new VariantMapper.Option(tagEnum, optionType)); - }) - .ToDictionary(k => k.Item1, k => k.Item2); - - List dependencies = options.Values - .Where(v => v.Type != null) - .Select(v => v.Type!) - .Distinct() - .ToList(); - List properties = objType .GetProperties(BindingFlags.Instance | BindingFlags.Public) .ToList(); - const string defaultTypePropertyName = "Tag"; - PropertyInfo? typeProperty = properties + PropertyInfo? variantTagProperty = properties .FirstOrDefault(p => p.GetCustomAttribute() != null) ?? properties.FirstOrDefault(p => p.Name == defaultTypePropertyName); - if (typeProperty == null) + if (variantTagProperty == null) { throw new InvalidOperationException($"Variant type '{objType.FullName}' must include a property named '{defaultTypePropertyName}' or have the '{typeof(VariantTagPropertyAttribute).FullName}' attribute on a property"); } @@ -479,6 +457,98 @@ private static IResolvableTypeInfo BuildVariant(Type objType, VariantAttribute a { throw new InvalidOperationException($"Variant type '{objType.FullName}' must include a property named '{defaultValuePropertyName}' or have the '{typeof(VariantValuePropertyAttribute).FullName}' attribute on a property"); } + object? variant = Activator.CreateInstance(objType, nonPublic: true); + + if (!variantTagProperty.PropertyType.IsEnum) + { + throw new Exception($"Variant tag type must be an enum of all the variant options, not type '{variantTagProperty.PropertyType}'"); + } + Type variantEnumType = variantTagProperty.PropertyType; + Dictionary tagEnumValues = variantEnumType + .GetEnumValues() + .Cast() + .ToDictionary( + t => (CandidTag)Enum.GetName(variantTagProperty.PropertyType, t), + t => t + ); + + var optionTypes = new Dictionary(); + foreach(MethodInfo classMethod in objType.GetMethods(BindingFlags.Instance | BindingFlags.Public)) + { + CandidTag tag; + var optionAttribute = classMethod.GetCustomAttribute(); + if (optionAttribute != null) + { + tag = optionAttribute.Tag; + } + else if (classMethod.Name.StartsWith("As")) + { + tag = classMethod.Name[2..]; // Remove As prefix + } + else + { + continue; + } + + optionTypes.Add(tag, classMethod.ReturnType); + } + foreach(PropertyInfo property in properties) + { + if(property == variantTagProperty || property == valueProperty) + { + // Skip tag and value properties + continue; + } + CandidTag tag; + var optionAttribute = property.GetCustomAttribute(); + if (optionAttribute != null) + { + // If property has the attribute + tag = optionAttribute.Tag; + } + else if (variantEnumType.IsEnumDefined(property.Name)) + { + // If property is the same name as the enum value + tag = property.Name; + } + else + { + continue; + } + if (!optionTypes.TryGetValue(tag, out Type optionType)) + { + // Add if not already added by a method + optionTypes.Add(tag, property.PropertyType); + } + else + { + if (optionType != property.PropertyType) + { + throw new Exception($"Conflict: Variant '{objType.FullName}' defines a property '{property.Name}' and a method with different types for an option"); + } + // Method and Property, skip adding... + } + } + + Dictionary options = tagEnumValues + .Select(t => + { + CandidTag tagName = t.Key; + Enum tagEnum = t.Value; + MemberInfo enumOption = variantTagProperty.PropertyType.GetMember(tagName.Name).First(); + Type? optionType = optionTypes.GetValueOrDefault(tagName); + var tagAttribute = enumOption.GetCustomAttribute(); + CandidTag tag = tagAttribute?.Tag ?? tagName; + return (tag, new VariantMapper.Option(tagEnum, optionType)); + }) + .ToDictionary(k => k.Item1, k => k.Item2); + + List dependencies = options.Values + .Where(v => v.Type != null) + .Select(v => v.Type!) + .Distinct() + .ToList(); + return new ComplexTypeInfo(objType, dependencies, (resolvedDependencies) => { Dictionary optionCandidTypes = options @@ -495,7 +565,7 @@ private static IResolvableTypeInfo BuildVariant(Type objType, VariantAttribute a ); var type = new CandidVariantType(optionCandidTypes); - var mapper = new VariantMapper(type, objType, typeProperty, valueProperty, options); + var mapper = new VariantMapper(type, objType, variantTagProperty, valueProperty, options); return (mapper, type); }); } diff --git a/src/Candid/Mapping/MapperAttributes.cs b/src/Candid/Mapping/MapperAttributes.cs index 0075eb30..81a84c38 100644 --- a/src/Candid/Mapping/MapperAttributes.cs +++ b/src/Candid/Mapping/MapperAttributes.cs @@ -63,21 +63,6 @@ public class CandidIgnoreAttribute : Attribute [AttributeUsage(AttributeTargets.Class)] public class VariantAttribute : Attribute { - /// - /// The enum type to use for specifying the tags of the variant - /// - public Type TagType { get; } - - /// The enum type to use for specifying the tags of the variant - /// Throws if the type is not an enum - public VariantAttribute(Type enumType) - { - if (!enumType.IsEnum) - { - throw new ArgumentException("Type must be an enum"); - } - this.TagType = enumType; - } } /// @@ -102,18 +87,24 @@ public class VariantValuePropertyAttribute : Attribute /// An attribute to put on an enum option to specify if the tag has an attached /// value in the variant, otherwise the attached type will be null /// - [AttributeUsage(AttributeTargets.Field)] - public class VariantOptionTypeAttribute : Attribute + [AttributeUsage(AttributeTargets.Method | AttributeTargets.Property)] + public class VariantOptionAttribute : Attribute { /// /// The type of the variant option value to use /// - public Type OptionType { get; } + public CandidTag Tag { get; } - /// The type of the variant option value to use - public VariantOptionTypeAttribute(Type optionType) + /// The tag of the variant option + public VariantOptionAttribute(CandidTag tag) { - this.OptionType = optionType; + this.Tag = tag; + } + + /// The tag of the variant option + public VariantOptionAttribute(string tag) : this(CandidTag.FromName(tag)) + { + } } } diff --git a/src/Candid/Mapping/Mappers/RawCandidMapper.cs b/src/Candid/Mapping/Mappers/RawCandidMapper.cs new file mode 100644 index 00000000..370ad56e --- /dev/null +++ b/src/Candid/Mapping/Mappers/RawCandidMapper.cs @@ -0,0 +1,34 @@ +using EdjCase.ICP.Candid.Models.Types; +using EdjCase.ICP.Candid.Models.Values; +using EdjCase.ICP.Candid.Models; +using System; +using System.Collections.Generic; +using System.Reflection; +using System.Linq; + +namespace EdjCase.ICP.Candid.Mapping.Mappers +{ + internal class RawCandidMapper : ICandidValueMapper + { + public CandidType CandidType { get; set; } + public RawCandidMapper(CandidType candidType) + { + this.CandidType = candidType; + } + + public object Map(CandidValue value, CandidConverter converter) + { + return value; + } + + public CandidValue Map(object obj, CandidConverter converter) + { + return (CandidValue)obj; + } + + public CandidType? GetMappedCandidType(Type type) + { + return this.CandidType; + } + } +} diff --git a/src/ClientGenerator/API.md b/src/ClientGenerator/API.md index 46c00a71..6af28af9 100644 --- a/src/ClientGenerator/API.md +++ b/src/ClientGenerator/API.md @@ -8,7 +8,7 @@ - [GenerateClientFromCanisterAsync(canisterId,options)](#M-EdjCase-ICP-ClientGenerator-ClientCodeGenerator-GenerateClientFromCanisterAsync-EdjCase-ICP-Candid-Models-Principal,EdjCase-ICP-ClientGenerator-ClientGenerationOptions- 'EdjCase.ICP.ClientGenerator.ClientCodeGenerator.GenerateClientFromCanisterAsync(EdjCase.ICP.Candid.Models.Principal,EdjCase.ICP.ClientGenerator.ClientGenerationOptions)') - [GenerateClientFromFile(fileText,options)](#M-EdjCase-ICP-ClientGenerator-ClientCodeGenerator-GenerateClientFromFile-System-String,EdjCase-ICP-ClientGenerator-ClientGenerationOptions- 'EdjCase.ICP.ClientGenerator.ClientCodeGenerator.GenerateClientFromFile(System.String,EdjCase.ICP.ClientGenerator.ClientGenerationOptions)') - [ClientGenerationOptions](#T-EdjCase-ICP-ClientGenerator-ClientGenerationOptions 'EdjCase.ICP.ClientGenerator.ClientGenerationOptions') - - [#ctor(name,namespace,getDefinitionFromCanister,filePathOrCandidId,outputDirectory,purgeOutputDirectory,noFolders,featureNullable,keepCandidCase,boundryNodeUrl,types)](#M-EdjCase-ICP-ClientGenerator-ClientGenerationOptions-#ctor-System-String,System-String,System-Boolean,System-String,System-String,System-Boolean,System-Boolean,System-Boolean,System-Boolean,System-Uri,System-Collections-Generic-Dictionary{System-String,EdjCase-ICP-ClientGenerator-NamedTypeOptions}- 'EdjCase.ICP.ClientGenerator.ClientGenerationOptions.#ctor(System.String,System.String,System.Boolean,System.String,System.String,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Uri,System.Collections.Generic.Dictionary{System.String,EdjCase.ICP.ClientGenerator.NamedTypeOptions})') + - [#ctor(name,namespace,getDefinitionFromCanister,filePathOrCandidId,outputDirectory,purgeOutputDirectory,noFolders,featureNullable,variantsUseProperties,keepCandidCase,boundryNodeUrl,types)](#M-EdjCase-ICP-ClientGenerator-ClientGenerationOptions-#ctor-System-String,System-String,System-Boolean,System-String,System-String,System-Boolean,System-Boolean,System-Boolean,System-Boolean,System-Boolean,System-Uri,System-Collections-Generic-Dictionary{System-String,EdjCase-ICP-ClientGenerator-NamedTypeOptions}- 'EdjCase.ICP.ClientGenerator.ClientGenerationOptions.#ctor(System.String,System.String,System.Boolean,System.String,System.String,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Boolean,System.Uri,System.Collections.Generic.Dictionary{System.String,EdjCase.ICP.ClientGenerator.NamedTypeOptions})') - [BoundryNodeUrl](#P-EdjCase-ICP-ClientGenerator-ClientGenerationOptions-BoundryNodeUrl 'EdjCase.ICP.ClientGenerator.ClientGenerationOptions.BoundryNodeUrl') - [FeatureNullable](#P-EdjCase-ICP-ClientGenerator-ClientGenerationOptions-FeatureNullable 'EdjCase.ICP.ClientGenerator.ClientGenerationOptions.FeatureNullable') - [FilePathOrCanisterId](#P-EdjCase-ICP-ClientGenerator-ClientGenerationOptions-FilePathOrCanisterId 'EdjCase.ICP.ClientGenerator.ClientGenerationOptions.FilePathOrCanisterId') @@ -20,6 +20,7 @@ - [OutputDirectory](#P-EdjCase-ICP-ClientGenerator-ClientGenerationOptions-OutputDirectory 'EdjCase.ICP.ClientGenerator.ClientGenerationOptions.OutputDirectory') - [PurgeOutputDirectory](#P-EdjCase-ICP-ClientGenerator-ClientGenerationOptions-PurgeOutputDirectory 'EdjCase.ICP.ClientGenerator.ClientGenerationOptions.PurgeOutputDirectory') - [Types](#P-EdjCase-ICP-ClientGenerator-ClientGenerationOptions-Types 'EdjCase.ICP.ClientGenerator.ClientGenerationOptions.Types') + - [VariantsUseProperties](#P-EdjCase-ICP-ClientGenerator-ClientGenerationOptions-VariantsUseProperties 'EdjCase.ICP.ClientGenerator.ClientGenerationOptions.VariantsUseProperties') - [ClientSyntax](#T-EdjCase-ICP-ClientGenerator-ClientSyntax 'EdjCase.ICP.ClientGenerator.ClientSyntax') - [#ctor(name,clientFile,typeFiles)](#M-EdjCase-ICP-ClientGenerator-ClientSyntax-#ctor-System-String,Microsoft-CodeAnalysis-CSharp-Syntax-CompilationUnitSyntax,System-Collections-Generic-List{System-ValueTuple{System-String,Microsoft-CodeAnalysis-CSharp-Syntax-CompilationUnitSyntax}}- 'EdjCase.ICP.ClientGenerator.ClientSyntax.#ctor(System.String,Microsoft.CodeAnalysis.CSharp.Syntax.CompilationUnitSyntax,System.Collections.Generic.List{System.ValueTuple{System.String,Microsoft.CodeAnalysis.CSharp.Syntax.CompilationUnitSyntax}})') - [ClientFile](#P-EdjCase-ICP-ClientGenerator-ClientSyntax-ClientFile 'EdjCase.ICP.ClientGenerator.ClientSyntax.ClientFile') @@ -28,29 +29,15 @@ - [GenerateFileContents()](#M-EdjCase-ICP-ClientGenerator-ClientSyntax-GenerateFileContents 'EdjCase.ICP.ClientGenerator.ClientSyntax.GenerateFileContents') - [GenerateFileContents(syntax)](#M-EdjCase-ICP-ClientGenerator-ClientSyntax-GenerateFileContents-Microsoft-CodeAnalysis-CSharp-Syntax-CompilationUnitSyntax- 'EdjCase.ICP.ClientGenerator.ClientSyntax.GenerateFileContents(Microsoft.CodeAnalysis.CSharp.Syntax.CompilationUnitSyntax)') - [Rewrite(rewriter)](#M-EdjCase-ICP-ClientGenerator-ClientSyntax-Rewrite-Microsoft-CodeAnalysis-CSharp-CSharpSyntaxRewriter- 'EdjCase.ICP.ClientGenerator.ClientSyntax.Rewrite(Microsoft.CodeAnalysis.CSharp.CSharpSyntaxRewriter)') -- [ITypeOptions](#T-EdjCase-ICP-ClientGenerator-ITypeOptions 'EdjCase.ICP.ClientGenerator.ITypeOptions') - - [Type](#P-EdjCase-ICP-ClientGenerator-ITypeOptions-Type 'EdjCase.ICP.ClientGenerator.ITypeOptions.Type') - [NamedTypeOptions](#T-EdjCase-ICP-ClientGenerator-NamedTypeOptions 'EdjCase.ICP.ClientGenerator.NamedTypeOptions') - - [#ctor(nameOverride,typeOptions)](#M-EdjCase-ICP-ClientGenerator-NamedTypeOptions-#ctor-System-String,EdjCase-ICP-ClientGenerator-ITypeOptions- 'EdjCase.ICP.ClientGenerator.NamedTypeOptions.#ctor(System.String,EdjCase.ICP.ClientGenerator.ITypeOptions)') + - [#ctor(nameOverride,typeOptions)](#M-EdjCase-ICP-ClientGenerator-NamedTypeOptions-#ctor-System-String,EdjCase-ICP-ClientGenerator-TypeOptions- 'EdjCase.ICP.ClientGenerator.NamedTypeOptions.#ctor(System.String,EdjCase.ICP.ClientGenerator.TypeOptions)') - [NameOverride](#P-EdjCase-ICP-ClientGenerator-NamedTypeOptions-NameOverride 'EdjCase.ICP.ClientGenerator.NamedTypeOptions.NameOverride') - [TypeOptions](#P-EdjCase-ICP-ClientGenerator-NamedTypeOptions-TypeOptions 'EdjCase.ICP.ClientGenerator.NamedTypeOptions.TypeOptions') -- [RecordTypeOptions](#T-EdjCase-ICP-ClientGenerator-RecordTypeOptions 'EdjCase.ICP.ClientGenerator.RecordTypeOptions') - - [#ctor(fields)](#M-EdjCase-ICP-ClientGenerator-RecordTypeOptions-#ctor-System-Collections-Generic-Dictionary{System-String,EdjCase-ICP-ClientGenerator-NamedTypeOptions}- 'EdjCase.ICP.ClientGenerator.RecordTypeOptions.#ctor(System.Collections.Generic.Dictionary{System.String,EdjCase.ICP.ClientGenerator.NamedTypeOptions})') - - [Fields](#P-EdjCase-ICP-ClientGenerator-RecordTypeOptions-Fields 'EdjCase.ICP.ClientGenerator.RecordTypeOptions.Fields') - - [Type](#P-EdjCase-ICP-ClientGenerator-RecordTypeOptions-Type 'EdjCase.ICP.ClientGenerator.RecordTypeOptions.Type') -- [VariantTypeOptions](#T-EdjCase-ICP-ClientGenerator-VariantTypeOptions 'EdjCase.ICP.ClientGenerator.VariantTypeOptions') - - [#ctor(options)](#M-EdjCase-ICP-ClientGenerator-VariantTypeOptions-#ctor-System-Collections-Generic-Dictionary{System-String,EdjCase-ICP-ClientGenerator-NamedTypeOptions}- 'EdjCase.ICP.ClientGenerator.VariantTypeOptions.#ctor(System.Collections.Generic.Dictionary{System.String,EdjCase.ICP.ClientGenerator.NamedTypeOptions})') - - [Options](#P-EdjCase-ICP-ClientGenerator-VariantTypeOptions-Options 'EdjCase.ICP.ClientGenerator.VariantTypeOptions.Options') - - [Type](#P-EdjCase-ICP-ClientGenerator-VariantTypeOptions-Type 'EdjCase.ICP.ClientGenerator.VariantTypeOptions.Type') -- [VectorRepresentation](#T-EdjCase-ICP-ClientGenerator-VectorRepresentation 'EdjCase.ICP.ClientGenerator.VectorRepresentation') - - [Array](#F-EdjCase-ICP-ClientGenerator-VectorRepresentation-Array 'EdjCase.ICP.ClientGenerator.VectorRepresentation.Array') - - [Dictionary](#F-EdjCase-ICP-ClientGenerator-VectorRepresentation-Dictionary 'EdjCase.ICP.ClientGenerator.VectorRepresentation.Dictionary') - - [List](#F-EdjCase-ICP-ClientGenerator-VectorRepresentation-List 'EdjCase.ICP.ClientGenerator.VectorRepresentation.List') -- [VectorTypeOptions](#T-EdjCase-ICP-ClientGenerator-VectorTypeOptions 'EdjCase.ICP.ClientGenerator.VectorTypeOptions') - - [#ctor(representation,elementType)](#M-EdjCase-ICP-ClientGenerator-VectorTypeOptions-#ctor-System-Nullable{EdjCase-ICP-ClientGenerator-VectorRepresentation},EdjCase-ICP-ClientGenerator-ITypeOptions- 'EdjCase.ICP.ClientGenerator.VectorTypeOptions.#ctor(System.Nullable{EdjCase.ICP.ClientGenerator.VectorRepresentation},EdjCase.ICP.ClientGenerator.ITypeOptions)') - - [ElementType](#P-EdjCase-ICP-ClientGenerator-VectorTypeOptions-ElementType 'EdjCase.ICP.ClientGenerator.VectorTypeOptions.ElementType') - - [Representation](#P-EdjCase-ICP-ClientGenerator-VectorTypeOptions-Representation 'EdjCase.ICP.ClientGenerator.VectorTypeOptions.Representation') - - [Type](#P-EdjCase-ICP-ClientGenerator-VectorTypeOptions-Type 'EdjCase.ICP.ClientGenerator.VectorTypeOptions.Type') +- [TypeOptions](#T-EdjCase-ICP-ClientGenerator-TypeOptions 'EdjCase.ICP.ClientGenerator.TypeOptions') + - [#ctor(fields,innerType,representation)](#M-EdjCase-ICP-ClientGenerator-TypeOptions-#ctor-System-Collections-Generic-Dictionary{System-String,EdjCase-ICP-ClientGenerator-NamedTypeOptions},EdjCase-ICP-ClientGenerator-TypeOptions,System-String- 'EdjCase.ICP.ClientGenerator.TypeOptions.#ctor(System.Collections.Generic.Dictionary{System.String,EdjCase.ICP.ClientGenerator.NamedTypeOptions},EdjCase.ICP.ClientGenerator.TypeOptions,System.String)') + - [Fields](#P-EdjCase-ICP-ClientGenerator-TypeOptions-Fields 'EdjCase.ICP.ClientGenerator.TypeOptions.Fields') + - [InnerType](#P-EdjCase-ICP-ClientGenerator-TypeOptions-InnerType 'EdjCase.ICP.ClientGenerator.TypeOptions.InnerType') + - [Representation](#P-EdjCase-ICP-ClientGenerator-TypeOptions-Representation 'EdjCase.ICP.ClientGenerator.TypeOptions.Representation') ## ClientCodeGenerator `type` @@ -118,8 +105,8 @@ EdjCase.ICP.ClientGenerator Options for generating a client - -### #ctor(name,namespace,getDefinitionFromCanister,filePathOrCandidId,outputDirectory,purgeOutputDirectory,noFolders,featureNullable,keepCandidCase,boundryNodeUrl,types) `constructor` + +### #ctor(name,namespace,getDefinitionFromCanister,filePathOrCandidId,outputDirectory,purgeOutputDirectory,noFolders,featureNullable,variantsUseProperties,keepCandidCase,boundryNodeUrl,types) `constructor` ##### Parameters @@ -133,6 +120,7 @@ Options for generating a client | purgeOutputDirectory | [System.Boolean](http://msdn.microsoft.com/query/dev14.query?appId=Dev14IDEF1&l=EN-US&k=k:System.Boolean 'System.Boolean') | If true, removes all files in the output directory before regeneration. Defaults to true | | noFolders | [System.Boolean](http://msdn.microsoft.com/query/dev14.query?appId=Dev14IDEF1&l=EN-US&k=k:System.Boolean 'System.Boolean') | If true, there will be no folders, all files will be in the same directory | | featureNullable | [System.Boolean](http://msdn.microsoft.com/query/dev14.query?appId=Dev14IDEF1&l=EN-US&k=k:System.Boolean 'System.Boolean') | If true, the nullable C# feature will be used | +| variantsUseProperties | [System.Boolean](http://msdn.microsoft.com/query/dev14.query?appId=Dev14IDEF1&l=EN-US&k=k:System.Boolean 'System.Boolean') | If true, variant classes will be generated with properties instead of methods | | keepCandidCase | [System.Boolean](http://msdn.microsoft.com/query/dev14.query?appId=Dev14IDEF1&l=EN-US&k=k:System.Boolean 'System.Boolean') | If true, the names of properties and methods will keep the raw candid name. Otherwise they will be converted to something prettier | | boundryNodeUrl | [System.Uri](http://msdn.microsoft.com/query/dev14.query?appId=Dev14IDEF1&l=EN-US&k=k:System.Uri 'System.Uri') | Optional. The url of the boundry node for the internet computer. Defaults to ic0.app | | types | [System.Collections.Generic.Dictionary{System.String,EdjCase.ICP.ClientGenerator.NamedTypeOptions}](http://msdn.microsoft.com/query/dev14.query?appId=Dev14IDEF1&l=EN-US&k=k:System.Collections.Generic.Dictionary 'System.Collections.Generic.Dictionary{System.String,EdjCase.ICP.ClientGenerator.NamedTypeOptions}') | Optional. Specifies options for each candid type in the definition | @@ -216,6 +204,13 @@ If true, removes all files in the output directory before regeneration, otherwis Optional. Specifies options for each candid type in the definition. Only supports named types, no anonymous types + +### VariantsUseProperties `property` + +##### Summary + +If true, variant classes will be generated with properties instead of methods + ## ClientSyntax `type` @@ -308,24 +303,6 @@ Updated client syntax | ---- | ---- | ----------- | | rewriter | [Microsoft.CodeAnalysis.CSharp.CSharpSyntaxRewriter](#T-Microsoft-CodeAnalysis-CSharp-CSharpSyntaxRewriter 'Microsoft.CodeAnalysis.CSharp.CSharpSyntaxRewriter') | A \`CSharpSyntaxRewriter\` to rewrite the csharp syntax | - -## ITypeOptions `type` - -##### Namespace - -EdjCase.ICP.ClientGenerator - -##### Summary - -Interface to specify generation options for specific types in the candid - - -### Type `property` - -##### Summary - -The candid type of the implementation class - ## NamedTypeOptions `type` @@ -337,7 +314,7 @@ EdjCase.ICP.ClientGenerator Type options for a record field or variant option - + ### #ctor(nameOverride,typeOptions) `constructor` ##### Parameters @@ -345,7 +322,7 @@ Type options for a record field or variant option | Name | Type | Description | | ---- | ---- | ----------- | | nameOverride | [System.String](http://msdn.microsoft.com/query/dev14.query?appId=Dev14IDEF1&l=EN-US&k=k:System.String 'System.String') | Optional. The C# type name to use instead of the default | -| typeOptions | [EdjCase.ICP.ClientGenerator.ITypeOptions](#T-EdjCase-ICP-ClientGenerator-ITypeOptions 'EdjCase.ICP.ClientGenerator.ITypeOptions') | Optional. The field or option type information | +| typeOptions | [EdjCase.ICP.ClientGenerator.TypeOptions](#T-EdjCase-ICP-ClientGenerator-TypeOptions 'EdjCase.ICP.ClientGenerator.TypeOptions') | Optional. The field or option type information | ### NameOverride `property` @@ -361,8 +338,8 @@ Optional. The C# type name to use instead of the default Optional. The field or option type information - -## RecordTypeOptions `type` + +## TypeOptions `type` ##### Namespace @@ -370,135 +347,42 @@ EdjCase.ICP.ClientGenerator ##### Summary -Type generation options for record candid types - - -### #ctor(fields) `constructor` - -##### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| fields | [System.Collections.Generic.Dictionary{System.String,EdjCase.ICP.ClientGenerator.NamedTypeOptions}](http://msdn.microsoft.com/query/dev14.query?appId=Dev14IDEF1&l=EN-US&k=k:System.Collections.Generic.Dictionary 'System.Collections.Generic.Dictionary{System.String,EdjCase.ICP.ClientGenerator.NamedTypeOptions}') | Optional. The type options for each of the records fields | - - -### Fields `property` - -##### Summary - -Optional. The type options for each of the records fields - - -### Type `property` - -##### Summary - -*Inherit from parent.* - - -## VariantTypeOptions `type` - -##### Namespace - -EdjCase.ICP.ClientGenerator - -##### Summary - -Type generation options for variant candid types +Interface to specify generation options for specific types in the candid - -### #ctor(options) `constructor` + +### #ctor(fields,innerType,representation) `constructor` ##### Parameters | Name | Type | Description | | ---- | ---- | ----------- | -| options | [System.Collections.Generic.Dictionary{System.String,EdjCase.ICP.ClientGenerator.NamedTypeOptions}](http://msdn.microsoft.com/query/dev14.query?appId=Dev14IDEF1&l=EN-US&k=k:System.Collections.Generic.Dictionary 'System.Collections.Generic.Dictionary{System.String,EdjCase.ICP.ClientGenerator.NamedTypeOptions}') | Optional. The type options for each of the variant options | +| fields | [System.Collections.Generic.Dictionary{System.String,EdjCase.ICP.ClientGenerator.NamedTypeOptions}](http://msdn.microsoft.com/query/dev14.query?appId=Dev14IDEF1&l=EN-US&k=k:System.Collections.Generic.Dictionary 'System.Collections.Generic.Dictionary{System.String,EdjCase.ICP.ClientGenerator.NamedTypeOptions}') | Optional. The type options for each of the records fields or variant options | +| innerType | [EdjCase.ICP.ClientGenerator.TypeOptions](#T-EdjCase-ICP-ClientGenerator-TypeOptions 'EdjCase.ICP.ClientGenerator.TypeOptions') | Optional. The type options for the sub type of a vec or opt | +| representation | [System.String](http://msdn.microsoft.com/query/dev14.query?appId=Dev14IDEF1&l=EN-US&k=k:System.String 'System.String') | Optional. How the type should be represented in C# | - -### Options `property` +##### Exceptions -##### Summary - -Optional. The type options for each of the variant options - - -### Type `property` - -##### Summary - -*Inherit from parent.* - - -## VectorRepresentation `type` - -##### Namespace - -EdjCase.ICP.ClientGenerator - -##### Summary - -C# type representations for the vec type - - -### Array `constants` - -##### Summary - -Vector will be an array - - -### Dictionary `constants` - -##### Summary +| Name | Description | +| ---- | ----------- | +| [System.ArgumentNullException](http://msdn.microsoft.com/query/dev14.query?appId=Dev14IDEF1&l=EN-US&k=k:System.ArgumentNullException 'System.ArgumentNullException') | | -Vector will be a dictionary, only if the element type is a record with 2 fields - - -### List `constants` - -##### Summary - -Vector will be a List - - -## VectorTypeOptions `type` - -##### Namespace - -EdjCase.ICP.ClientGenerator + +### Fields `property` ##### Summary -Type generation options for vec candid types +Optional. The type options for each of the records fields or variant options - -### #ctor(representation,elementType) `constructor` - -##### Parameters - -| Name | Type | Description | -| ---- | ---- | ----------- | -| representation | [System.Nullable{EdjCase.ICP.ClientGenerator.VectorRepresentation}](http://msdn.microsoft.com/query/dev14.query?appId=Dev14IDEF1&l=EN-US&k=k:System.Nullable 'System.Nullable{EdjCase.ICP.ClientGenerator.VectorRepresentation}') | Optional. The representation the vec should take in the generated code | -| elementType | [EdjCase.ICP.ClientGenerator.ITypeOptions](#T-EdjCase-ICP-ClientGenerator-ITypeOptions 'EdjCase.ICP.ClientGenerator.ITypeOptions') | Optional. The type options for the element type in the vec | - - -### ElementType `property` + +### InnerType `property` ##### Summary -Optional. The type options for the element type in the vec +Optional. The type options for the sub type of a vec or opt - + ### Representation `property` ##### Summary -Optional. The representation the vec should take in the generated code - - -### Type `property` - -##### Summary - -*Inherit from parent.* +Optional. How the type should be represented in C# diff --git a/src/ClientGenerator/API.xml b/src/ClientGenerator/API.xml index 6e5db3da..7346d100 100644 --- a/src/ClientGenerator/API.xml +++ b/src/ClientGenerator/API.xml @@ -77,6 +77,11 @@ If true, the nullable C# feature will be used + + + 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. @@ -94,7 +99,7 @@ Only supports named types, no anonymous types - + The name of the client class and file to use The base namespace to use in the generated files If true, will treat as a canister id and get the definition from the canister. Otherwise will treat it as a file path and get the definition from the file @@ -103,6 +108,7 @@ If true, removes all files in the output directory before regeneration. Defaults to true If true, there will be no folders, all files will be in the same directory If true, the nullable C# feature will be used + 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 Optional. The url of the boundry node for the internet computer. Defaults to ic0.app Optional. Specifies options for each candid type in the definition @@ -122,93 +128,35 @@ Optional. The field or option type information - + Optional. The C# type name to use instead of the default Optional. The field or option type information - + Interface to specify generation options for specific types in the candid - - - The candid type of the implementation class - - - - - Type generation options for record candid types - - - - - - - - Optional. The type options for each of the records fields - - - - Optional. The type options for each of the records fields - - - - Type generation options for vec candid types - - - - - - + - Optional. The representation the vec should take in the generated code + Optional. The type options for each of the records fields or variant options - + - Optional. The type options for the element type in the vec + Optional. The type options for the sub type of a vec or opt - - Optional. The representation the vec should take in the generated code - Optional. The type options for the element type in the vec - - - - C# type representations for the vec type - - - - - Vector will be a List - - - - - Vector will be an array - - - - - Vector will be a dictionary, only if the element type is a record with 2 fields - - - - - Type generation options for variant candid types - - - - - - + - Optional. The type options for each of the variant options + Optional. How the type should be represented in C# - - Optional. The type options for each of the variant options + + Optional. The type options for each of the records fields or variant options + Optional. The type options for the sub type of a vec or opt + Optional. How the type should be represented in C# + diff --git a/src/ClientGenerator/ClientCodeGenerator.cs b/src/ClientGenerator/ClientCodeGenerator.cs index 5ff7eb1f..274a56c5 100644 --- a/src/ClientGenerator/ClientCodeGenerator.cs +++ b/src/ClientGenerator/ClientCodeGenerator.cs @@ -4,6 +4,8 @@ using EdjCase.ICP.Candid.Models.Values; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp.Syntax; +using Org.BouncyCastle.Crypto.Agreement; +using Org.BouncyCastle.Ocsp; using System; using System.Collections.Generic; using System.Linq; @@ -100,6 +102,7 @@ ClientGenerationOptions options modelNamespace, aliases, options.FeatureNullable, + options.VariantsUseProperties, nameHelper, declaredTypes ); @@ -148,18 +151,8 @@ ClientGenerationOptions options private static SourceCodeType ResolveSourceCodeType( CandidType type, NameHelper nameHelper, - ITypeOptions? typeOptions) + TypeOptions? typeOptions) { - T? GetTypeOptions() - where T : class, ITypeOptions - { - if (typeOptions != null - && typeOptions is not T) - { - throw new Exception($"Type is '{typeOptions.GetType()}' but type options assume '{typeof(T)}'. Fix config"); - } - return typeOptions as T; - } switch (type) { @@ -198,24 +191,24 @@ private static SourceCodeType ResolveSourceCodeType( } case CandidVectorType v: { - VectorTypeOptions? vTypeOptions = GetTypeOptions(); - ITypeOptions? innerTypeOptions = vTypeOptions?.ElementType; + TypeOptions? innerTypeOptions = typeOptions?.InnerType; SourceCodeType innerType = ResolveSourceCodeType( v.InnerType, nameHelper, innerTypeOptions ); bool isDictionaryCompatible = innerType is TupleSourceCodeType t && t.Fields.Count == 2; - VectorRepresentation defaultRepresentation = isDictionaryCompatible - ? VectorRepresentation.Dictionary - : VectorRepresentation.List; - switch (vTypeOptions?.Representation ?? defaultRepresentation) + string defaultRepresentation = isDictionaryCompatible + ? "dictionary" + : "list"; + string rep = typeOptions?.Representation ?? defaultRepresentation; + switch (rep.ToLower()) { - case VectorRepresentation.Array: + case "array": return new ArraySourceCodeType(innerType); - case VectorRepresentation.List: + case "list": return new ListSourceCodeType(innerType); - case VectorRepresentation.Dictionary: + case "dictionary": if (!isDictionaryCompatible) { throw new Exception("List to dictionary conversion is only compatible with `vec record { a; b }` candid types"); @@ -225,7 +218,7 @@ private static SourceCodeType ResolveSourceCodeType( SourceCodeType valueType = tuple.Fields[1]; return new DictionarySourceCodeType(keyType, valueType); default: - throw new NotImplementedException(); + throw new Exception($"Vec types do not support representation: '{rep}'"); } } case CandidOptionalType o: @@ -240,7 +233,6 @@ private static SourceCodeType ResolveSourceCodeType( } case CandidRecordType o: { - RecordTypeOptions? rTypeOptions = GetTypeOptions(); // Check if tuple (tag ids are 0...N) bool isTuple = o.Fields.Any() @@ -251,12 +243,12 @@ private static SourceCodeType ResolveSourceCodeType( // Only be a tuple if it doesnt reference itself && !o.Fields.Any(f => f.Value is CandidReferenceType r && r.Id == o.RecursiveId); - if(isTuple ) + if(isTuple) { List tupleFields = o.Fields .Select(f => { - NamedTypeOptions? fieldTypeOptions = rTypeOptions?.Fields.GetValueOrDefault(f.Key.ToString()); + NamedTypeOptions? fieldTypeOptions = typeOptions?.Fields.GetValueOrDefault(f.Key.ToString()); return ResolveSourceCodeType( f.Value, nameHelper, @@ -271,7 +263,7 @@ private static SourceCodeType ResolveSourceCodeType( .Select(f => { CandidType fCandidType = f.Value; - NamedTypeOptions? fieldTypeOptions = f.Key.Name == null ? null : rTypeOptions?.Fields.GetValueOrDefault(f.Key.Name); + NamedTypeOptions? fieldTypeOptions = f.Key.Name == null ? null : typeOptions?.Fields.GetValueOrDefault(f.Key.Name); SourceCodeType fType = ResolveSourceCodeType(fCandidType, nameHelper, fieldTypeOptions?.TypeOptions); ResolvedName fieldName = nameHelper.ResolveName(f.Key, fieldTypeOptions?.NameOverride); return (fieldName, fType); @@ -282,11 +274,10 @@ private static SourceCodeType ResolveSourceCodeType( } case CandidVariantType va: { - VariantTypeOptions? variantTypeOptions = GetTypeOptions(); List<(ResolvedName Key, SourceCodeType? Type)> fields = va.Options .Select(f => { - NamedTypeOptions? innerTypeOptions = f.Key.Name == null ? null : variantTypeOptions?.Options.GetValueOrDefault(f.Key.Name); + NamedTypeOptions? innerTypeOptions = f.Key.Name == null ? null : typeOptions?.Fields.GetValueOrDefault(f.Key.Name); // If type is null, then just be a typeless variant SourceCodeType? sourceCodeType = f.Value == CandidType.Null() ? null diff --git a/src/ClientGenerator/ClientGenerationOptions.cs b/src/ClientGenerator/ClientGenerationOptions.cs index 04d394ea..acc1f5ca 100644 --- a/src/ClientGenerator/ClientGenerationOptions.cs +++ b/src/ClientGenerator/ClientGenerationOptions.cs @@ -48,6 +48,10 @@ public class ClientGenerationOptions /// public bool FeatureNullable { get; } /// + /// If true, variant classes will be generated with properties instead of methods + /// + public bool VariantsUseProperties { get; } + /// /// If true, the names of properties and methods will keep the raw candid name. /// Otherwise they will be converted to something prettier /// @@ -72,6 +76,7 @@ public class ClientGenerationOptions /// If true, removes all files in the output directory before regeneration. Defaults to true /// If true, there will be no folders, all files will be in the same directory /// If true, the nullable C# feature will be used + /// 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 /// Optional. The url of the boundry node for the internet computer. Defaults to ic0.app /// Optional. Specifies options for each candid type in the definition @@ -84,6 +89,7 @@ public ClientGenerationOptions( bool purgeOutputDirectory = true, bool noFolders = false, bool featureNullable = false, + bool variantsUseProperties = false, bool keepCandidCase = false, Uri? boundryNodeUrl = null, Dictionary? types = null @@ -102,6 +108,7 @@ public ClientGenerationOptions( this.PurgeOutputDirectory = purgeOutputDirectory; this.NoFolders = noFolders; this.FeatureNullable = featureNullable; + this.VariantsUseProperties = variantsUseProperties; this.KeepCandidCase = keepCandidCase; this.BoundryNodeUrl = boundryNodeUrl; this.Types = types ?? new Dictionary(); @@ -121,13 +128,13 @@ public class NamedTypeOptions /// /// Optional. The field or option type information /// - public ITypeOptions? TypeOptions { get; } + public TypeOptions? TypeOptions { get; } /// Optional. The C# type name to use instead of the default /// Optional. The field or option type information public NamedTypeOptions( string? nameOverride = null, - ITypeOptions? typeOptions = null + TypeOptions? typeOptions = null ) { this.NameOverride = nameOverride; @@ -138,105 +145,34 @@ public NamedTypeOptions( /// /// Interface to specify generation options for specific types in the candid /// - public interface ITypeOptions - { - //public string? NameOverride { get; init; } // TODO - - /// - /// The candid type of the implementation class - /// - public CandidTypeCode Type { get; } - - } - - /// - /// Type generation options for record candid types - /// - public class RecordTypeOptions : ITypeOptions + public class TypeOptions { - - /// - public CandidTypeCode Type { get; } = CandidTypeCode.Record; /// - /// Optional. The type options for each of the records fields + /// Optional. The type options for each of the records fields or variant options /// public Dictionary Fields { get; } - - /// Optional. The type options for each of the records fields - public RecordTypeOptions( - Dictionary? fields = null - ) - { - this.Fields = fields ?? new Dictionary(); - } - - } - - /// - /// Type generation options for vec candid types - /// - public class VectorTypeOptions : ITypeOptions - { - /// - public CandidTypeCode Type { get; } = CandidTypeCode.Vector; /// - /// Optional. The representation the vec should take in the generated code + /// Optional. The type options for the sub type of a vec or opt /// - public VectorRepresentation? Representation { get; } + public TypeOptions? InnerType { get; } /// - /// Optional. The type options for the element type in the vec + /// Optional. How the type should be represented in C# /// - public ITypeOptions? ElementType { get; } + public string? Representation { get; } - /// Optional. The representation the vec should take in the generated code - /// Optional. The type options for the element type in the vec - public VectorTypeOptions( - VectorRepresentation? representation = null, - ITypeOptions? elementType = null + /// Optional. The type options for each of the records fields or variant options + /// Optional. The type options for the sub type of a vec or opt + /// Optional. How the type should be represented in C# + /// + public TypeOptions( + Dictionary? fields, + TypeOptions? innerType, + string? representation ) { + this.Fields = fields ?? new Dictionary(); + this.InnerType = innerType; this.Representation = representation; - this.ElementType = elementType; - } - } - - /// - /// C# type representations for the vec type - /// - public enum VectorRepresentation - { - /// - /// Vector will be a List - /// - List, - /// - /// Vector will be an array - /// - Array, - /// - /// Vector will be a dictionary, only if the element type is a record with 2 fields - /// - Dictionary - } - - /// - /// Type generation options for variant candid types - /// - public class VariantTypeOptions : ITypeOptions - { - /// - public CandidTypeCode Type { get; } = CandidTypeCode.Vector; - /// - /// Optional. The type options for each of the variant options - /// - public Dictionary Options { get; } - - /// Optional. The type options for each of the variant options - public VariantTypeOptions( - Dictionary? options = null - ) - { - this.Options = options ?? new Dictionary(); } } } diff --git a/src/ClientGenerator/README.md b/src/ClientGenerator/README.md index 1e089806..16dbd0fb 100644 --- a/src/ClientGenerator/README.md +++ b/src/ClientGenerator/README.md @@ -24,23 +24,19 @@ Creates `candid-client.toml` file to update in specified directory Example: ``` -namespace = "My.Namespace" # Base namespace used for generated files -output-directory = "./Clients" # Directory to put clients. Each client will get its own sub folder based on its name. If not specified, will use current directory -no-folders = false # If true, will put all the files in a single directory +namespace = "My.Namespace" +output-directory = "./Clients" +no-folders = false [[clients]] -name = "Dex" # Used for the name of the folder and client class -type = "file" # Create client based on service definition file -file-path = "./ServiceDefinitionFiles/Dex.did" # Service definition file path -output-directory = "./Clients/D" # Override base output directory, but this specifies the subfolder -no-folders = false # If true, will put all the files in a single directory +name = "Dex" +type = "file" +file-path = "./ServiceDefinitionFiles/Dex.did" - -# Can specify multiple clients by defining another [[clients]] name = "Governance" -type = "canister" # Create client based on canister -canister-id = "rrkah-fqaaa-aaaaa-aaaaq-cai" # Canister to create client for +type = "canister" +canister-id = "rrkah-fqaaa-aaaaa-aaaaq-cai" ``` ### Generate clients @@ -80,8 +76,83 @@ candid-client-generator gen ./ - `feature-nullable` - (Bool) Optional. Sets whether to use the C# nullable feature when generating the client (like `object?`). Defaults to true. Overrides the top level `feature-nullable` - `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. Overrides the top level `keep-candid-case` +#### Type Customization: + +##### All Types + +`[clients.types.{CandidTypeId}]` + +`{CandidTypeId}` is any named type in the candid definition + +- `name` - Optional. (Text) Overrides the name of the C# type/alias generated + +--- + +##### Record Types Options + +- `[clients.types.{CandidTypeId}.fields.{CandidFieldId}]` + + `{CandidFieldId}` is a record field in the record type `{CandidTypeId}` + + Uses the same options as the top level `[clients.types.{CandidTypeId}]` section + +--- + +##### Variant Types Options + +- `representation` - Optional (Text) Sets what C# type should be generated. (Defaults to Dictionary if possible, otherwise a List) + + - `ClassWithMethods` - (Default) Uses a C# class with method accessors + - `ClassWithProperties` - Uses a C# class with property accessors + +- `[clients.types.{CandidTypeId}.fields.{CandidOptionId}]` + + `{CandidOptionId}` is a variant option in the variant type `{CandidTypeId}` + + Uses the same options as the top level `[clients.types.{CandidTypeId}]` section + +--- + +##### Vec Types Options + +- `representation` - Optional (Text) Sets what C# type should be generated. (Defaults to Dictionary if possible, otherwise a List) + + - `Array` - Uses a C# array + - `Dictionary` - (Default if applicable) Uses a C# `Dictionary`. Only works if the `vec` contains a `record` with 2 unamed fields (tuple). The first will be the key, the second will be the value + - `List` - (Default if not Dictionary) Uses a C# `List` + +- `[clients.types.{CandidTypeId}.innerType]` + + Uses the same options as the top level `[clients.types.{CandidTypeId}]` section, but `name` is not supported + +##### Opt Types Options + +- `[clients.types.{CandidTypeId}.innerType]` + + Uses the same options as the top level `[clients.types.{CandidTypeId}]` section, but `name` is not supported + +##### Type Customization Example: + +``` +[clients] +... + +[clients.types.AccountIdentifier] +name = "AccountId" +[clients.types.AccountIdentifier.fields.hash] +name = "Hash" +representation = "Array" + +[clients.types.Action.fields.RegisterKnownNeuron] +name = "RegisterNeuron" # Rename RegisterKnownNeuron -> RegisterNeuron +[clients.types.Action.fields.RegisterKnownNeuron.fields.id] # Update the type's field `id` +name = "ID" # Rename id -> ID +[clients.types.Action.fields.RegisterKnownNeuron.fields.id.innerType.fields.id] # Update the opt's inner record type's field `id` +name = "ID" # Rename id -> ID +``` # Custom Client Generators via Code + Due to the complexity of different use cases, custom tweaks to the output of the client generators might be helpful. This process can be handled with calling the `ClientCodeGenerator` manually and using the .NET `CSharpSyntaxRewriter` (tutorial can be found [HERE](https://joshvarty.com/2014/08/15/learn-roslyn-now-part-5-csharpsyntaxrewriter/)) @@ -98,4 +169,4 @@ var rewriter = new MyCustomCSharpSyntaxRewriter(); syntax = syntax.Rewrite(rewriter); (string clientFile, List<(string Name, string Contents)> typeFiles) = syntax.GenerateFileContents(); // Write string contents to files... -``` \ No newline at end of file +``` diff --git a/src/ClientGenerator/ResolvedName.cs b/src/ClientGenerator/ResolvedName.cs index d3a10bfa..a1f786bf 100644 --- a/src/ClientGenerator/ResolvedName.cs +++ b/src/ClientGenerator/ResolvedName.cs @@ -80,21 +80,22 @@ public ResolvedName ResolveName(CandidTag tag, string? nameOverride = null) stringValue = "F" + stringValue; } stringValue = this.KeepCandidCase ? stringValue : StringUtil.ToPascalCase(stringValue); - if (IsKeyword(stringValue)) + stringValue = Escape(stringValue); + return new ResolvedName(stringValue, tag); + } + + private static string Escape(string value) + { + if (IsKeyword(value)) { // Add @ before reserved words - stringValue = "@" + stringValue; + value = "@" + value; } - if (stringValue.StartsWith("set_") || stringValue.StartsWith("get_")) + if (value.StartsWith("set_") || value.StartsWith("get_")) { // Add _ before getters/setters words - stringValue = "_" + stringValue; + value = "_" + value; } - return new ResolvedName(stringValue, tag); - } - - private static string Escape(string value) - { return value; } diff --git a/src/ClientGenerator/RoslynTypeResolver.cs b/src/ClientGenerator/RoslynTypeResolver.cs index 53df4768..250afaac 100644 --- a/src/ClientGenerator/RoslynTypeResolver.cs +++ b/src/ClientGenerator/RoslynTypeResolver.cs @@ -14,6 +14,8 @@ using EdjCase.ICP.Candid; using System.Xml.Linq; using System.Reflection; +using Org.BouncyCastle.Asn1.Cms; +using EdjCase.ICP.Agent.Models; namespace EdjCase.ICP.ClientGenerator { @@ -24,6 +26,7 @@ internal class RoslynTypeResolver public string ModelNamespace { get; } public HashSet Aliases { get; } public bool FeatureNullable { get; } + public bool VariantsUseProperties { get; } public NameHelper NameHelper { get; } public Dictionary DeclaredTypes { get; } @@ -31,6 +34,7 @@ public RoslynTypeResolver( string modelNamespace, HashSet aliases, bool featureNullable, + bool variantsUseProperties, NameHelper nameHelper, Dictionary declaredTypes ) @@ -38,6 +42,7 @@ public RoslynTypeResolver( this.ModelNamespace = modelNamespace; this.Aliases = aliases; this.FeatureNullable = featureNullable; + this.VariantsUseProperties = variantsUseProperties; this.NameHelper = nameHelper; this.DeclaredTypes = declaredTypes; } @@ -101,7 +106,7 @@ private ResolvedType ResolveTypeInner( ResolvedType resolvedValueType = this.ResolveType(d.ValueType, nameContext + "Value", parentType); MemberDeclarationSyntax[] generatedSyntax = (resolvedKeyType.GeneratedSyntax ?? Array.Empty()) .Concat(resolvedValueType.GeneratedSyntax ?? Array.Empty()) - .ToArray();; + .ToArray(); ; var name = new DictionaryTypeName(resolvedKeyType.Name, resolvedValueType.Name); return new ResolvedType(name, generatedSyntax); } @@ -158,12 +163,12 @@ private ResolvedType ResolveTypeInner( case VariantSourceCodeType v: { TypeName variantName = this.BuildType(nameContext, parentType); - (ClassDeclarationSyntax? classSyntax, EnumDeclarationSyntax enumSyntax) = this.GenerateVariant(variantName, v, parentType); - if (classSyntax != null) + (ClassDeclarationSyntax? ClassSyntax, EnumDeclarationSyntax EnumSyntax) result = this.GenerateVariant(variantName, v, parentType); + if (result.ClassSyntax != null) { - return new ResolvedType(variantName, new MemberDeclarationSyntax[] { classSyntax, enumSyntax }); + return new ResolvedType(variantName, new MemberDeclarationSyntax[] { result.ClassSyntax, result.EnumSyntax }); } - return new ResolvedType(variantName, new MemberDeclarationSyntax []{ enumSyntax }); + return new ResolvedType(variantName, new MemberDeclarationSyntax[] { result.EnumSyntax }); } case RecordSourceCodeType r: { @@ -254,7 +259,6 @@ public ClassDeclarationSyntax GenerateClient( .Select(ResolveOption) .ToList(); - List<(ResolvedName Name, TypeName? Type)> enumOptions = resolvedOptions .Select(o => (o.Name, o.Type?.Name)) .ToList(); @@ -271,25 +275,6 @@ public ClassDeclarationSyntax GenerateClient( { TypeName enumTypeName = this.BuildType(variantTypeName.BuildName(false) + "Tag", parentType); - - List methods = new(); - - - // Creation methods - // public static {VariantType} {OptionName}({VariantOptionType} value) - // or if there is no type: - // public static {VariantType} {OptionName}() - methods.AddRange( - resolvedOptions - .Select(o => this.GenerateVariantOptionCreationMethod( - variantTypeName, - enumTypeName, - o.Name, - o.Type, - "info" - )) - ); - // TODO auto change the property values of all class types if it matches the name bool containsClashingTag = variantTypeName.BuildName(false) == "Tag" || variant.Options.Any(o => o.Tag.Name == "Tag"); @@ -299,49 +284,59 @@ public ClassDeclarationSyntax GenerateClient( || variant.Options.Any(o => o.Tag.Name == "Value"); string valueName = containsClashingValue ? "Value_" : "Value"; - // '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)) - ); - - - bool anyOptionsWithType = resolvedOptions.Any(o => o.Type != null); - if (anyOptionsWithType) + List properties = new() { - // If there are any types, then create the helper method 'ValidateType' that - // they all use - methods.Add(this.GenerateVariantValidateTypeMethod(enumTypeName, tagName)); + 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 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 attributes = new() - { - // [Variant(typeof({enumType})] - this.GenerateAttribute(AttributeInfo.FromType(enumTypeName)) - }; - + { + // [Variant] + this.GenerateAttribute(AttributeInfo.FromType()) + }; ClassDeclarationSyntax classSyntax = this.GenerateClass( name: variantTypeName, properties: properties, optionalProperties: null, + customProperties: customProperties, methods: methods, attributes: attributes, emptyConstructorAccess: AccessType.Protected, @@ -354,6 +349,178 @@ public ClassDeclarationSyntax GenerateClient( } } + private List GenerateVariantProperties( + TypeName variantTypeName, + TypeName enumTypeName, + string valueName, + string tagName, + List<(ResolvedName Name, ResolvedType? Type)> 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 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(), + SyntaxFactory.IdentifierName(o.Name.Name) + ) + ), + // ({OptionType}) this.Value! + SyntaxFactory.CastExpression( + o.Type!.Name.ToTypeSyntax(), + 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(), + SyntaxFactory.IdentifierName(o.Name.Name) + ) + ), + SyntaxFactory.Token(SyntaxKind.CommaToken), + SyntaxFactory.Argument( + SyntaxFactory.IdentifierName("value") + ) + } + ) + ) + ) + )) + .WithSemicolonToken( + SyntaxFactory.Token(SyntaxKind.SemicolonToken) + ) + }; + TypeName fixedTypeName = this.FeatureNullable + ? new NullableTypeName(o.Type.Name) + : o.Type.Name; + return SyntaxFactory.PropertyDeclaration( + fixedTypeName.ToTypeSyntax(), + o.Name.Name + ) + .WithModifiers( + SyntaxFactory.TokenList( + SyntaxFactory.Token(SyntaxKind.PublicKeyword) + ) + ) + .WithAccessorList(SyntaxFactory.AccessorList( + SyntaxFactory.List(accessors) + )); + }) + .ToList(); + + } + + private List GenerateVariantMethods( + TypeName variantTypeName, + TypeName enumTypeName, + string valueName, + string tagName, + List<(ResolvedName Name, ResolvedType? Type)> 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" + )) + .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)) + ); + + + 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) { string @namespace; @@ -531,6 +698,7 @@ string valueName ) ) ); + return this.GenerateMethod( body: body, access: AccessType.Public, @@ -739,15 +907,6 @@ private EnumDeclarationSyntax GenerateEnum(TypeName enumName, List<(ResolvedName new AttributeInfo(SimpleTypeName.FromType(), v.Name.CandidTag.Name!) )); } - - if (v.Type != null) - { - // [VariantOptionType(typeof({type}))] - attributeList.Add(this.GenerateAttribute( - new AttributeInfo(SimpleTypeName.FromType(), v.Type) - )); - - } return SyntaxFactory // {optionName}, .EnumMemberDeclaration(SyntaxFactory.Identifier(v.Name.Name)) @@ -1410,6 +1569,7 @@ private ClassDeclarationSyntax GenerateClass( List properties, List? optionalProperties = null, List? methods = null, + List? customProperties = null, List? implementTypes = null, List? attributes = null, AccessType? emptyConstructorAccess = null, @@ -1448,11 +1608,16 @@ ClassProperty FixDuplicates(ClassProperty property) .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 constructors.Add(this.GenerateConstructor(name, AccessType.Public, properties, optionalProperties)); } + if (emptyConstructorAccess != null) { // Empty Constrcutor for reflection diff --git a/src/ClientGenerator/SourceCodeType.cs b/src/ClientGenerator/SourceCodeType.cs index e1fe9b30..26b18ffe 100644 --- a/src/ClientGenerator/SourceCodeType.cs +++ b/src/ClientGenerator/SourceCodeType.cs @@ -115,7 +115,9 @@ internal class VariantSourceCodeType : SourceCodeType public List<(ResolvedName Tag, SourceCodeType? Type)> Options { get; } public override bool IsPredefinedType { get; } = false; - public VariantSourceCodeType(List<(ResolvedName Tag, SourceCodeType? Type)> options) + public VariantSourceCodeType( + List<(ResolvedName Tag, SourceCodeType? Type)> options + ) { this.Options = options ?? throw new ArgumentNullException(nameof(options)); } diff --git a/src/ClientGenerator/TomlConfigParser.cs b/src/ClientGenerator/TomlConfigParser.cs index b5046f8f..a3e99de7 100644 --- a/src/ClientGenerator/TomlConfigParser.cs +++ b/src/ClientGenerator/TomlConfigParser.cs @@ -63,6 +63,7 @@ public static List Parse(string filePath) purgeOutputDirectory: clientOptions.PurgeDirectory ?? true, noFolders: clientOptions.NoFolders ?? false, featureNullable: clientOptions.FeatureNullable ?? true, + variantsUseProperties: clientOptions.VariantsUseProperties ?? false, keepCandidCase: clientOptions.KeepCandidCase ?? false, boundryNodeUrl: clientOptions.BaseUrl, types: clientOptions.Types @@ -81,6 +82,7 @@ private static CommonOptions ParseCommonOptions(TomlTable config, (CommonOptions bool? noFolders = GetOptional(config, "no-folders") ?? parent?.Options.NoFolders; string? outputDirectory = GetOptional(config, "output-directory") ?? (parent == null ? null : Path.Combine(parent.Value.Options.OutputDirectory ?? "./", parent.Value.ClientName)); bool? featureNullable = GetOptional(config, "feature-nullable") ?? parent?.Options.FeatureNullable; + bool? variantsUseProperties = GetOptional(config, "variants-use-properties") ?? parent?.Options.VariantsUseProperties; bool? keepCandidCase = GetOptional(config, "keep-candid-case") ?? parent?.Options.KeepCandidCase; TomlTable? typeTable = GetOptional(config, "types"); Dictionary types = BuildTypes(typeTable); @@ -106,6 +108,7 @@ private static CommonOptions ParseCommonOptions(TomlTable config, (CommonOptions noFolders, outputDirectory, featureNullable, + variantsUseProperties, keepCandidCase, types ); @@ -131,50 +134,24 @@ private static Dictionary BuildTypes(TomlTable? typeTa throw new Exception($"Options for type '{key}' cannot be parsed"); } string? name = GetOptional(t, "name"); - ITypeOptions? typeOptions = BuildTypeOptions(t); + TypeOptions? typeOptions = BuildTypeOptions(t); types.Add(key, new NamedTypeOptions(name, typeOptions)); } } return types; } - private static ITypeOptions? BuildTypeOptions(TomlTable t) + private static TypeOptions BuildTypeOptions(TomlTable t) { - string? typeType = GetOptional(t, "type"); - if (string.IsNullOrWhiteSpace(typeType)) - { - return null; - } - switch (typeType.ToLower()) - { - case "record": - { - TomlTable? fieldTypeTable = GetOptional(t, "fields"); - Dictionary fields = BuildTypes(fieldTypeTable); - return new RecordTypeOptions( - fields: fields - ); - } - case "vec": - { - ITypeOptions? elementType = GetOptional(t, "elementType"); - VectorRepresentation? representation = GetEnumOptional(t, "representation"); - return new VectorTypeOptions( - representation: representation, - elementType: elementType - ); - } - case "variant": - { - TomlTable? optionTypeTable = GetOptional(t, "options"); - Dictionary options = BuildTypes(optionTypeTable); - return new VariantTypeOptions( - options: options - ); - } - default: - throw new Exception($"Type '{typeType.ToLower()}' is invalid"); - } + string? representation = GetOptional(t, "representation"); + + TomlTable? optionTypeTable = GetOptional(t, "fields"); + Dictionary options = BuildTypes(optionTypeTable); + + TomlTable? innerTypeTable = GetOptional(t, "innerType"); + TypeOptions? innerType = innerTypeTable == null ? null : BuildTypeOptions(innerTypeTable); + + return new TypeOptions(options, innerType, representation); } private static T GetRequired(TomlTable table, string key, string? prefix = null) @@ -199,24 +176,6 @@ private static T GetRequired(TomlTable table, string key, string? prefix = nu return default; } - private static TEnum GetEnumRequired(TomlTable table, string key) - where TEnum : struct - { - string stringValue = GetRequired(table, key); - return (TEnum)Enum.Parse(typeof(TEnum), stringValue); - } - - private static TEnum? GetEnumOptional(TomlTable table, string key) - where TEnum : struct - { - string? stringValue = GetOptional(table, key); - if (stringValue == null) - { - return null; - } - return (TEnum)Enum.Parse(typeof(TEnum), stringValue); - } - } internal class CommonOptions @@ -227,6 +186,7 @@ internal class CommonOptions public bool? NoFolders { get; } public string? OutputDirectory { get; } public bool? FeatureNullable { get; } + public bool? VariantsUseProperties { get; } public bool? KeepCandidCase { get; } public Dictionary Types { get; } @@ -237,6 +197,7 @@ public CommonOptions( bool? noFolders, string? outputDirectory, bool? featureNullable, + bool? variantsUseProperties, bool? keepCandidCase, Dictionary? types ) @@ -247,6 +208,7 @@ public CommonOptions( this.NoFolders = noFolders; this.OutputDirectory = outputDirectory; this.FeatureNullable = featureNullable; + this.VariantsUseProperties = variantsUseProperties; this.KeepCandidCase = keepCandidCase; this.Types = types ?? new Dictionary(); } diff --git a/test/Candid.Tests/CandidConverterTests.cs b/test/Candid.Tests/CandidConverterTests.cs index c4933c6a..4cac9669 100644 --- a/test/Candid.Tests/CandidConverterTests.cs +++ b/test/Candid.Tests/CandidConverterTests.cs @@ -136,7 +136,7 @@ public void Record_From_Class() - [Variant(typeof(VariantValueClassType))] + [Variant] public class VariantValueClass { [VariantTagProperty] @@ -144,6 +144,15 @@ public class VariantValueClass [VariantValueProperty] public object? Value { get; set; } + + public int AsV3() + { + return (int)this.Value!; + } + public OptionalValue AsV4() + { + return (OptionalValue)this.Value!; + } } public enum VariantValueClassType @@ -151,13 +160,10 @@ public enum VariantValueClassType [CandidName("v1")] V1, [CandidName("v2")] - [VariantOptionType(typeof(string))] V2, [CandidName("v3")] - [VariantOptionType(typeof(int))] V3, [CandidName("v4")] - [VariantOptionType(typeof(OptionalValue))] V4 } diff --git a/test/Candid.Tests/Generators/ClientGeneratorTests.cs b/test/Candid.Tests/Generators/ClientGeneratorTests.cs index 84e517b7..6f7dab1f 100644 --- a/test/Candid.Tests/Generators/ClientGeneratorTests.cs +++ b/test/Candid.Tests/Generators/ClientGeneratorTests.cs @@ -28,14 +28,22 @@ public void GenerateClients(string serviceName) string fileText = GetFileText(serviceName + ".did"); string baseNamespace = "Test"; CandidServiceDescription serviceFile = CandidServiceDescription.Parse(fileText); - this.GenerateClientInternal(serviceFile, baseNamespace, serviceName, true, true, true); - this.GenerateClientInternal(serviceFile, baseNamespace, serviceName, true, true, false); - this.GenerateClientInternal(serviceFile, baseNamespace, serviceName, true, false, false); - this.GenerateClientInternal(serviceFile, baseNamespace, serviceName, true, false, true); - this.GenerateClientInternal(serviceFile, baseNamespace, serviceName, false, true, true); - this.GenerateClientInternal(serviceFile, baseNamespace, serviceName, false, true, false); - this.GenerateClientInternal(serviceFile, baseNamespace, serviceName, false, false, true); - this.GenerateClientInternal(serviceFile, baseNamespace, serviceName, false, false, false); + this.GenerateClientInternal(serviceFile, baseNamespace, serviceName, true, true, true, false); + this.GenerateClientInternal(serviceFile, baseNamespace, serviceName, true, true, false, false); + this.GenerateClientInternal(serviceFile, baseNamespace, serviceName, true, false, false, false); + this.GenerateClientInternal(serviceFile, baseNamespace, serviceName, true, false, true, false); + this.GenerateClientInternal(serviceFile, baseNamespace, serviceName, false, true, true, false); + this.GenerateClientInternal(serviceFile, baseNamespace, serviceName, false, true, false, false); + this.GenerateClientInternal(serviceFile, baseNamespace, serviceName, false, false, true, false); + this.GenerateClientInternal(serviceFile, baseNamespace, serviceName, false, false, false, false); + this.GenerateClientInternal(serviceFile, baseNamespace, serviceName, true, true, true, true); + this.GenerateClientInternal(serviceFile, baseNamespace, serviceName, true, true, false, true); + this.GenerateClientInternal(serviceFile, baseNamespace, serviceName, true, false, false, true); + this.GenerateClientInternal(serviceFile, baseNamespace, serviceName, true, false, true, true); + this.GenerateClientInternal(serviceFile, baseNamespace, serviceName, false, true, true, true); + this.GenerateClientInternal(serviceFile, baseNamespace, serviceName, false, true, false, true); + this.GenerateClientInternal(serviceFile, baseNamespace, serviceName, false, false, true, true); + this.GenerateClientInternal(serviceFile, baseNamespace, serviceName, false, false, false, true); } private void GenerateClientInternal( @@ -44,7 +52,8 @@ private void GenerateClientInternal( string serviceName, bool noFolders, bool featureNullable, - bool keepCandidCase + bool keepCandidCase, + bool variantsUseProperties ) { ClientGenerationOptions options = new( @@ -56,6 +65,7 @@ bool keepCandidCase purgeOutputDirectory: true, noFolders: noFolders, featureNullable: featureNullable, + variantsUseProperties: variantsUseProperties, keepCandidCase: keepCandidCase, boundryNodeUrl: null, types: null @@ -81,7 +91,7 @@ bool keepCandidCase //trees.Add(SyntaxFactory.SyntaxTree(f.Syntax)); } - Snapshot.Match(clientCode, $"{serviceName}_NoFolders_{noFolders}_Nullable_{featureNullable}_KeepCandidCase_{keepCandidCase}"); + Snapshot.Match(clientCode, $"{serviceName}_NoFolders_{noFolders}_Nullable_{featureNullable}_KeepCandidCase_{keepCandidCase}_VariantsUseProperties_{variantsUseProperties}"); //TODO //CSharpCompilation compilation = CSharpCompilation diff --git a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_False_KeepCandidCase_False.snap b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False.snap similarity index 100% rename from test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_False_KeepCandidCase_False.snap rename to test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False.snap diff --git a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_False_KeepCandidCase_False.snap b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True.snap similarity index 100% rename from test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_False_KeepCandidCase_False.snap rename to test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True.snap diff --git a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_False_KeepCandidCase_True.snap b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False.snap similarity index 100% rename from test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_False_KeepCandidCase_True.snap rename to test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False.snap diff --git a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_False_KeepCandidCase_True.snap b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True.snap similarity index 100% rename from test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_False_KeepCandidCase_True.snap rename to test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True.snap diff --git a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_True_KeepCandidCase_False.snap b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False.snap similarity index 100% rename from test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_True_KeepCandidCase_False.snap rename to test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False.snap diff --git a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_True_KeepCandidCase_False.snap b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True.snap similarity index 100% rename from test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_True_KeepCandidCase_False.snap rename to test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True.snap diff --git a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_True_KeepCandidCase_True.snap b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False.snap similarity index 100% rename from test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_True_KeepCandidCase_True.snap rename to test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False.snap diff --git a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_True_KeepCandidCase_True.snap b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True.snap similarity index 100% rename from test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_True_KeepCandidCase_True.snap rename to test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True.snap diff --git a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False.snap b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False.snap new file mode 100644 index 00000000..9b9e2d89 --- /dev/null +++ b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False.snap @@ -0,0 +1,41 @@ +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 +{ + public class AnonymousTuplesApiClient + { + public IAgent Agent { get; } + + public Principal CanisterId { get; } + + public CandidConverter Converter { get; } + + public AnonymousTuplesApiClient(IAgent agent, Principal canisterId, CandidConverter converter = default) + { + this.Agent = agent; + this.CanisterId = canisterId; + this.Converter = converter; + } + + public async Task>> A() + { + CandidArg arg = CandidArg.FromCandid(); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "a", arg); + CandidArg reply = response.ThrowOrGetReply(); + 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(); + return reply.ToObjects>(this.Converter); + } + } +} diff --git a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True.snap b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True.snap new file mode 100644 index 00000000..9b9e2d89 --- /dev/null +++ b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True.snap @@ -0,0 +1,41 @@ +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 +{ + public class AnonymousTuplesApiClient + { + public IAgent Agent { get; } + + public Principal CanisterId { get; } + + public CandidConverter Converter { get; } + + public AnonymousTuplesApiClient(IAgent agent, Principal canisterId, CandidConverter converter = default) + { + this.Agent = agent; + this.CanisterId = canisterId; + this.Converter = converter; + } + + public async Task>> A() + { + CandidArg arg = CandidArg.FromCandid(); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "a", arg); + CandidArg reply = response.ThrowOrGetReply(); + 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(); + return reply.ToObjects>(this.Converter); + } + } +} diff --git a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False.snap b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False.snap new file mode 100644 index 00000000..c214dad0 --- /dev/null +++ b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False.snap @@ -0,0 +1,41 @@ +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 +{ + public class AnonymousTuplesApiClient + { + public IAgent Agent { get; } + + public Principal CanisterId { get; } + + public CandidConverter Converter { get; } + + public AnonymousTuplesApiClient(IAgent agent, Principal canisterId, CandidConverter converter = default) + { + this.Agent = agent; + this.CanisterId = canisterId; + this.Converter = converter; + } + + public async Task>> a() + { + CandidArg arg = CandidArg.FromCandid(); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "a", arg); + CandidArg reply = response.ThrowOrGetReply(); + 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(); + return reply.ToObjects>(this.Converter); + } + } +} diff --git a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True.snap b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True.snap new file mode 100644 index 00000000..c214dad0 --- /dev/null +++ b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True.snap @@ -0,0 +1,41 @@ +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 +{ + public class AnonymousTuplesApiClient + { + public IAgent Agent { get; } + + public Principal CanisterId { get; } + + public CandidConverter Converter { get; } + + public AnonymousTuplesApiClient(IAgent agent, Principal canisterId, CandidConverter converter = default) + { + this.Agent = agent; + this.CanisterId = canisterId; + this.Converter = converter; + } + + public async Task>> a() + { + CandidArg arg = CandidArg.FromCandid(); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "a", arg); + CandidArg reply = response.ThrowOrGetReply(); + 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(); + return reply.ToObjects>(this.Converter); + } + } +} diff --git a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False.snap b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False.snap new file mode 100644 index 00000000..d331df95 --- /dev/null +++ b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False.snap @@ -0,0 +1,41 @@ +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 +{ + public class AnonymousTuplesApiClient + { + public IAgent Agent { get; } + + public Principal CanisterId { get; } + + public CandidConverter? Converter { get; } + + public AnonymousTuplesApiClient(IAgent agent, Principal canisterId, CandidConverter? converter = default) + { + this.Agent = agent; + this.CanisterId = canisterId; + this.Converter = converter; + } + + public async Task>> A() + { + CandidArg arg = CandidArg.FromCandid(); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "a", arg); + CandidArg reply = response.ThrowOrGetReply(); + 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(); + return reply.ToObjects>(this.Converter); + } + } +} diff --git a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True.snap b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True.snap new file mode 100644 index 00000000..d331df95 --- /dev/null +++ b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True.snap @@ -0,0 +1,41 @@ +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 +{ + public class AnonymousTuplesApiClient + { + public IAgent Agent { get; } + + public Principal CanisterId { get; } + + public CandidConverter? Converter { get; } + + public AnonymousTuplesApiClient(IAgent agent, Principal canisterId, CandidConverter? converter = default) + { + this.Agent = agent; + this.CanisterId = canisterId; + this.Converter = converter; + } + + public async Task>> A() + { + CandidArg arg = CandidArg.FromCandid(); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "a", arg); + CandidArg reply = response.ThrowOrGetReply(); + 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(); + return reply.ToObjects>(this.Converter); + } + } +} diff --git a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False.snap b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False.snap new file mode 100644 index 00000000..2fd21dd7 --- /dev/null +++ b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False.snap @@ -0,0 +1,41 @@ +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 +{ + public class AnonymousTuplesApiClient + { + public IAgent Agent { get; } + + public Principal CanisterId { get; } + + public CandidConverter? Converter { get; } + + public AnonymousTuplesApiClient(IAgent agent, Principal canisterId, CandidConverter? converter = default) + { + this.Agent = agent; + this.CanisterId = canisterId; + this.Converter = converter; + } + + public async Task>> a() + { + CandidArg arg = CandidArg.FromCandid(); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "a", arg); + CandidArg reply = response.ThrowOrGetReply(); + 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(); + return reply.ToObjects>(this.Converter); + } + } +} diff --git a/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True.snap b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True.snap new file mode 100644 index 00000000..2fd21dd7 --- /dev/null +++ b/test/Candid.Tests/Generators/__snapshots__/AnonymousTuples_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True.snap @@ -0,0 +1,41 @@ +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 +{ + public class AnonymousTuplesApiClient + { + public IAgent Agent { get; } + + public Principal CanisterId { get; } + + public CandidConverter? Converter { get; } + + public AnonymousTuplesApiClient(IAgent agent, Principal canisterId, CandidConverter? converter = default) + { + this.Agent = agent; + this.CanisterId = canisterId; + this.Converter = converter; + } + + public async Task>> a() + { + CandidArg arg = CandidArg.FromCandid(); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "a", arg); + CandidArg reply = response.ThrowOrGetReply(); + 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(); + return reply.ToObjects>(this.Converter); + } + } +} diff --git a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_False_KeepCandidCase_False.snap b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False.snap similarity index 95% rename from test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_False_KeepCandidCase_False.snap rename to test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False.snap index ea1050f6..334e66c5 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_False_KeepCandidCase_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False.snap @@ -136,7 +136,7 @@ using System; namespace Test.Models { - [Variant(typeof(WithdrawReceiptTag))] + [Variant()] public class WithdrawReceipt { [VariantTagProperty()] @@ -188,9 +188,7 @@ namespace Test.Models public enum WithdrawReceiptTag { - [VariantOptionType(typeof(WithdrawErr))] Err, - [VariantOptionType(typeof(UnboundedUInt))] Ok } } @@ -215,7 +213,7 @@ using System; namespace Test.Models { - [Variant(typeof(OrderPlacementReceiptTag))] + [Variant()] public class OrderPlacementReceipt { [VariantTagProperty()] @@ -267,9 +265,7 @@ namespace Test.Models public enum OrderPlacementReceiptTag { - [VariantOptionType(typeof(OrderPlacementErr))] Err, - [VariantOptionType(typeof(OptionalValue))] Ok } } @@ -339,7 +335,7 @@ using System; namespace Test.Models { - [Variant(typeof(DepositReceiptTag))] + [Variant()] public class DepositReceipt { [VariantTagProperty()] @@ -391,9 +387,7 @@ namespace Test.Models public enum DepositReceiptTag { - [VariantOptionType(typeof(DepositErr))] Err, - [VariantOptionType(typeof(UnboundedUInt))] Ok } } @@ -418,7 +412,7 @@ using OrderId = System.UInt32; namespace Test.Models { - [Variant(typeof(CancelOrderReceiptTag))] + [Variant()] public class CancelOrderReceipt { [VariantTagProperty()] @@ -470,9 +464,7 @@ namespace Test.Models public enum CancelOrderReceiptTag { - [VariantOptionType(typeof(CancelOrderErr))] Err, - [VariantOptionType(typeof(OrderId))] Ok } } diff --git a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True.snap b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True.snap new file mode 100644 index 00000000..0616c1e1 --- /dev/null +++ b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True.snap @@ -0,0 +1,405 @@ +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; + +namespace Test +{ + public class DexApiClient + { + public IAgent Agent { get; } + + public Principal CanisterId { get; } + + public CandidConverter Converter { get; } + + public DexApiClient(IAgent agent, Principal canisterId, CandidConverter converter = default) + { + this.Agent = agent; + this.CanisterId = canisterId; + this.Converter = converter; + } + + public async Task CancelOrder(OrderId arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "cancelOrder", arg); + return reply.ToObjects(this.Converter); + } + + public async Task Clear() + { + CandidArg arg = CandidArg.FromCandid(); + await this.Agent.CallAsync(this.CanisterId, "clear", arg); + } + + public async Task Credit(Principal arg0, Token arg1, UnboundedUInt arg2) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0), CandidTypedValue.FromObject(arg1), CandidTypedValue.FromObject(arg2)); + await this.Agent.CallAsync(this.CanisterId, "credit", arg); + } + + public async Task Deposit(Token arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "deposit", arg); + return reply.ToObjects(this.Converter); + } + + public async Task> GetAllBalances() + { + CandidArg arg = CandidArg.FromCandid(); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "getAllBalances", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects>(this.Converter); + } + + public async Task GetBalance(Token arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "getBalance", arg); + CandidArg reply = response.ThrowOrGetReply(); + 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(); + return reply.ToObjects>(this.Converter); + } + + public async Task> GetDepositAddress() + { + CandidArg arg = CandidArg.FromCandid(); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "getDepositAddress", arg); + return reply.ToObjects>(this.Converter); + } + + public async Task> GetOrder(OrderId arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "getOrder", arg); + return reply.ToObjects>(this.Converter); + } + + public async Task> GetOrders() + { + CandidArg arg = CandidArg.FromCandid(); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "getOrders", arg); + return reply.ToObjects>(this.Converter); + } + + public async Task GetSymbol(Token arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "getSymbol", arg); + return reply.ToObjects(this.Converter); + } + + public async Task PlaceOrder(Token arg0, UnboundedUInt arg1, Token arg2, UnboundedUInt arg3) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0), CandidTypedValue.FromObject(arg1), CandidTypedValue.FromObject(arg2), CandidTypedValue.FromObject(arg3)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "placeOrder", arg); + return reply.ToObjects(this.Converter); + } + + public async Task Whoami() + { + CandidArg arg = CandidArg.FromCandid(); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "whoami", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + + public async Task Withdraw(Token arg0, UnboundedUInt arg1, Principal arg2) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0), CandidTypedValue.FromObject(arg1), CandidTypedValue.FromObject(arg2)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "withdraw", arg); + return reply.ToObjects(this.Converter); + } + } +} + +Type File: 'WithdrawReceipt' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; +using EdjCase.ICP.Candid.Models; + +namespace Test.Models +{ + [Variant()] + public class WithdrawReceipt + { + [VariantTagProperty()] + public WithdrawReceiptTag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public WithdrawErr Err { get => this.Tag == WithdrawReceiptTag.Err ? (WithdrawErr)this.Value! : default; set => (this.Tag, this.Value) = (WithdrawReceiptTag.Err, value); } + + public UnboundedUInt Ok { get => this.Tag == WithdrawReceiptTag.Ok ? (UnboundedUInt)this.Value! : default; set => (this.Tag, this.Value) = (WithdrawReceiptTag.Ok, value); } + + public WithdrawReceipt(WithdrawReceiptTag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected WithdrawReceipt() + { + } + } + + public enum WithdrawReceiptTag + { + Err, + Ok + } +} + +Type File: 'WithdrawErr' + +namespace Test.Models +{ + public enum WithdrawErr + { + BalanceLow, + TransferFailure + } +} + +Type File: 'OrderPlacementReceipt' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; +using EdjCase.ICP.Candid.Models; + +namespace Test.Models +{ + [Variant()] + public class OrderPlacementReceipt + { + [VariantTagProperty()] + public OrderPlacementReceiptTag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public OrderPlacementErr Err { get => this.Tag == OrderPlacementReceiptTag.Err ? (OrderPlacementErr)this.Value! : default; set => (this.Tag, this.Value) = (OrderPlacementReceiptTag.Err, value); } + + public OptionalValue Ok { get => this.Tag == OrderPlacementReceiptTag.Ok ? (OptionalValue)this.Value! : default; set => (this.Tag, this.Value) = (OrderPlacementReceiptTag.Ok, value); } + + public OrderPlacementReceipt(OrderPlacementReceiptTag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected OrderPlacementReceipt() + { + } + } + + public enum OrderPlacementReceiptTag + { + Err, + Ok + } +} + +Type File: 'OrderPlacementErr' + +namespace Test.Models +{ + public enum OrderPlacementErr + { + InvalidOrder, + OrderBookFull + } +} + +Type File: 'Order' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Token = EdjCase.ICP.Candid.Models.Principal; +using OrderId = System.UInt32; + +namespace Test.Models +{ + public class Order + { + [CandidName("from")] + public Token From { get; set; } + + [CandidName("fromAmount")] + public UnboundedUInt FromAmount { get; set; } + + [CandidName("id")] + public OrderId Id { get; set; } + + [CandidName("owner")] + public Principal Owner { get; set; } + + [CandidName("to")] + public Token To { get; set; } + + [CandidName("toAmount")] + public UnboundedUInt ToAmount { get; set; } + + public Order(Token from, UnboundedUInt fromAmount, OrderId id, Principal owner, Token to, UnboundedUInt toAmount) + { + this.From = from; + this.FromAmount = fromAmount; + this.Id = id; + this.Owner = owner; + this.To = to; + this.ToAmount = toAmount; + } + + public Order() + { + } + } +} + +Type File: 'DepositReceipt' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; +using EdjCase.ICP.Candid.Models; + +namespace Test.Models +{ + [Variant()] + public class DepositReceipt + { + [VariantTagProperty()] + public DepositReceiptTag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public DepositErr Err { get => this.Tag == DepositReceiptTag.Err ? (DepositErr)this.Value! : default; set => (this.Tag, this.Value) = (DepositReceiptTag.Err, value); } + + public UnboundedUInt Ok { get => this.Tag == DepositReceiptTag.Ok ? (UnboundedUInt)this.Value! : default; set => (this.Tag, this.Value) = (DepositReceiptTag.Ok, value); } + + public DepositReceipt(DepositReceiptTag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected DepositReceipt() + { + } + } + + public enum DepositReceiptTag + { + Err, + Ok + } +} + +Type File: 'DepositErr' + +namespace Test.Models +{ + public enum DepositErr + { + BalanceLow, + TransferFailure + } +} + +Type File: 'CancelOrderReceipt' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; +using OrderId = System.UInt32; + +namespace Test.Models +{ + [Variant()] + public class CancelOrderReceipt + { + [VariantTagProperty()] + public CancelOrderReceiptTag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public CancelOrderErr Err { get => this.Tag == CancelOrderReceiptTag.Err ? (CancelOrderErr)this.Value! : default; set => (this.Tag, this.Value) = (CancelOrderReceiptTag.Err, value); } + + public OrderId Ok { get => this.Tag == CancelOrderReceiptTag.Ok ? (OrderId)this.Value! : default; set => (this.Tag, this.Value) = (CancelOrderReceiptTag.Ok, value); } + + public CancelOrderReceipt(CancelOrderReceiptTag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected CancelOrderReceipt() + { + } + } + + public enum CancelOrderReceiptTag + { + Err, + Ok + } +} + +Type File: 'CancelOrderErr' + +namespace Test.Models +{ + public enum CancelOrderErr + { + NotAllowed, + NotExistingOrder + } +} + +Type File: 'Balance' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Token = EdjCase.ICP.Candid.Models.Principal; + +namespace Test.Models +{ + public class Balance + { + [CandidName("amount")] + public UnboundedUInt Amount { get; set; } + + [CandidName("owner")] + public Principal Owner { get; set; } + + [CandidName("token")] + public Token Token { get; set; } + + public Balance(UnboundedUInt amount, Principal owner, Token token) + { + this.Amount = amount; + this.Owner = owner; + this.Token = token; + } + + public Balance() + { + } + } +} diff --git a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_False_KeepCandidCase_True.snap b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False.snap similarity index 95% rename from test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_False_KeepCandidCase_True.snap rename to test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False.snap index ba605c16..3f0ec588 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_False_KeepCandidCase_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False.snap @@ -136,7 +136,7 @@ using System; namespace Test.Models { - [Variant(typeof(WithdrawReceiptTag))] + [Variant()] public class WithdrawReceipt { [VariantTagProperty()] @@ -188,9 +188,7 @@ namespace Test.Models public enum WithdrawReceiptTag { - [VariantOptionType(typeof(WithdrawErr))] Err, - [VariantOptionType(typeof(UnboundedUInt))] Ok } } @@ -215,7 +213,7 @@ using System; namespace Test.Models { - [Variant(typeof(OrderPlacementReceiptTag))] + [Variant()] public class OrderPlacementReceipt { [VariantTagProperty()] @@ -267,9 +265,7 @@ namespace Test.Models public enum OrderPlacementReceiptTag { - [VariantOptionType(typeof(OrderPlacementErr))] Err, - [VariantOptionType(typeof(OptionalValue))] Ok } } @@ -332,7 +328,7 @@ using System; namespace Test.Models { - [Variant(typeof(DepositReceiptTag))] + [Variant()] public class DepositReceipt { [VariantTagProperty()] @@ -384,9 +380,7 @@ namespace Test.Models public enum DepositReceiptTag { - [VariantOptionType(typeof(DepositErr))] Err, - [VariantOptionType(typeof(UnboundedUInt))] Ok } } @@ -411,7 +405,7 @@ using OrderId = System.UInt32; namespace Test.Models { - [Variant(typeof(CancelOrderReceiptTag))] + [Variant()] public class CancelOrderReceipt { [VariantTagProperty()] @@ -463,9 +457,7 @@ namespace Test.Models public enum CancelOrderReceiptTag { - [VariantOptionType(typeof(CancelOrderErr))] Err, - [VariantOptionType(typeof(OrderId))] Ok } } diff --git a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True.snap b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True.snap new file mode 100644 index 00000000..3fa1a5ed --- /dev/null +++ b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True.snap @@ -0,0 +1,394 @@ +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; + +namespace Test +{ + public class DexApiClient + { + public IAgent Agent { get; } + + public Principal CanisterId { get; } + + public CandidConverter Converter { get; } + + public DexApiClient(IAgent agent, Principal canisterId, CandidConverter converter = default) + { + this.Agent = agent; + this.CanisterId = canisterId; + this.Converter = converter; + } + + public async Task cancelOrder(OrderId arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "cancelOrder", arg); + return reply.ToObjects(this.Converter); + } + + public async Task clear() + { + CandidArg arg = CandidArg.FromCandid(); + await this.Agent.CallAsync(this.CanisterId, "clear", arg); + } + + public async Task credit(Principal arg0, Token arg1, UnboundedUInt arg2) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0), CandidTypedValue.FromObject(arg1), CandidTypedValue.FromObject(arg2)); + await this.Agent.CallAsync(this.CanisterId, "credit", arg); + } + + public async Task deposit(Token arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "deposit", arg); + return reply.ToObjects(this.Converter); + } + + public async Task> getAllBalances() + { + CandidArg arg = CandidArg.FromCandid(); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "getAllBalances", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects>(this.Converter); + } + + public async Task getBalance(Token arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "getBalance", arg); + CandidArg reply = response.ThrowOrGetReply(); + 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(); + return reply.ToObjects>(this.Converter); + } + + public async Task> getDepositAddress() + { + CandidArg arg = CandidArg.FromCandid(); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "getDepositAddress", arg); + return reply.ToObjects>(this.Converter); + } + + public async Task> getOrder(OrderId arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "getOrder", arg); + return reply.ToObjects>(this.Converter); + } + + public async Task> getOrders() + { + CandidArg arg = CandidArg.FromCandid(); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "getOrders", arg); + return reply.ToObjects>(this.Converter); + } + + public async Task getSymbol(Token arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "getSymbol", arg); + return reply.ToObjects(this.Converter); + } + + public async Task placeOrder(Token arg0, UnboundedUInt arg1, Token arg2, UnboundedUInt arg3) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0), CandidTypedValue.FromObject(arg1), CandidTypedValue.FromObject(arg2), CandidTypedValue.FromObject(arg3)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "placeOrder", arg); + return reply.ToObjects(this.Converter); + } + + public async Task whoami() + { + CandidArg arg = CandidArg.FromCandid(); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "whoami", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + + public async Task withdraw(Token arg0, UnboundedUInt arg1, Principal arg2) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0), CandidTypedValue.FromObject(arg1), CandidTypedValue.FromObject(arg2)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "withdraw", arg); + return reply.ToObjects(this.Converter); + } + } +} + +Type File: 'WithdrawReceipt' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; +using EdjCase.ICP.Candid.Models; + +namespace Test.Models +{ + [Variant()] + public class WithdrawReceipt + { + [VariantTagProperty()] + public WithdrawReceiptTag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public WithdrawErr Err { get => this.Tag == WithdrawReceiptTag.Err ? (WithdrawErr)this.Value! : default; set => (this.Tag, this.Value) = (WithdrawReceiptTag.Err, value); } + + public UnboundedUInt Ok { get => this.Tag == WithdrawReceiptTag.Ok ? (UnboundedUInt)this.Value! : default; set => (this.Tag, this.Value) = (WithdrawReceiptTag.Ok, value); } + + public WithdrawReceipt(WithdrawReceiptTag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected WithdrawReceipt() + { + } + } + + public enum WithdrawReceiptTag + { + Err, + Ok + } +} + +Type File: 'WithdrawErr' + +namespace Test.Models +{ + public enum WithdrawErr + { + BalanceLow, + TransferFailure + } +} + +Type File: 'OrderPlacementReceipt' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; +using EdjCase.ICP.Candid.Models; + +namespace Test.Models +{ + [Variant()] + public class OrderPlacementReceipt + { + [VariantTagProperty()] + public OrderPlacementReceiptTag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public OrderPlacementErr Err { get => this.Tag == OrderPlacementReceiptTag.Err ? (OrderPlacementErr)this.Value! : default; set => (this.Tag, this.Value) = (OrderPlacementReceiptTag.Err, value); } + + public OptionalValue Ok { get => this.Tag == OrderPlacementReceiptTag.Ok ? (OptionalValue)this.Value! : default; set => (this.Tag, this.Value) = (OrderPlacementReceiptTag.Ok, value); } + + public OrderPlacementReceipt(OrderPlacementReceiptTag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected OrderPlacementReceipt() + { + } + } + + public enum OrderPlacementReceiptTag + { + Err, + Ok + } +} + +Type File: 'OrderPlacementErr' + +namespace Test.Models +{ + public enum OrderPlacementErr + { + InvalidOrder, + OrderBookFull + } +} + +Type File: 'Order' + +using EdjCase.ICP.Candid.Models; +using Token = EdjCase.ICP.Candid.Models.Principal; +using OrderId = System.UInt32; + +namespace Test.Models +{ + public class Order + { + public Token from { get; set; } + + public UnboundedUInt fromAmount { get; set; } + + public OrderId id { get; set; } + + public Principal owner { get; set; } + + public Token to { get; set; } + + public UnboundedUInt toAmount { get; set; } + + public Order(Token from, UnboundedUInt fromAmount, OrderId id, Principal owner, Token to, UnboundedUInt toAmount) + { + this.from = from; + this.fromAmount = fromAmount; + this.id = id; + this.owner = owner; + this.to = to; + this.toAmount = toAmount; + } + + public Order() + { + } + } +} + +Type File: 'DepositReceipt' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; +using EdjCase.ICP.Candid.Models; + +namespace Test.Models +{ + [Variant()] + public class DepositReceipt + { + [VariantTagProperty()] + public DepositReceiptTag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public DepositErr Err { get => this.Tag == DepositReceiptTag.Err ? (DepositErr)this.Value! : default; set => (this.Tag, this.Value) = (DepositReceiptTag.Err, value); } + + public UnboundedUInt Ok { get => this.Tag == DepositReceiptTag.Ok ? (UnboundedUInt)this.Value! : default; set => (this.Tag, this.Value) = (DepositReceiptTag.Ok, value); } + + public DepositReceipt(DepositReceiptTag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected DepositReceipt() + { + } + } + + public enum DepositReceiptTag + { + Err, + Ok + } +} + +Type File: 'DepositErr' + +namespace Test.Models +{ + public enum DepositErr + { + BalanceLow, + TransferFailure + } +} + +Type File: 'CancelOrderReceipt' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; +using OrderId = System.UInt32; + +namespace Test.Models +{ + [Variant()] + public class CancelOrderReceipt + { + [VariantTagProperty()] + public CancelOrderReceiptTag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public CancelOrderErr Err { get => this.Tag == CancelOrderReceiptTag.Err ? (CancelOrderErr)this.Value! : default; set => (this.Tag, this.Value) = (CancelOrderReceiptTag.Err, value); } + + public OrderId Ok { get => this.Tag == CancelOrderReceiptTag.Ok ? (OrderId)this.Value! : default; set => (this.Tag, this.Value) = (CancelOrderReceiptTag.Ok, value); } + + public CancelOrderReceipt(CancelOrderReceiptTag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected CancelOrderReceipt() + { + } + } + + public enum CancelOrderReceiptTag + { + Err, + Ok + } +} + +Type File: 'CancelOrderErr' + +namespace Test.Models +{ + public enum CancelOrderErr + { + NotAllowed, + NotExistingOrder + } +} + +Type File: 'Balance' + +using EdjCase.ICP.Candid.Models; +using Token = EdjCase.ICP.Candid.Models.Principal; + +namespace Test.Models +{ + public class Balance + { + public UnboundedUInt amount { get; set; } + + public Principal owner { get; set; } + + public Token token { get; set; } + + public Balance(UnboundedUInt amount, Principal owner, Token token) + { + this.amount = amount; + this.owner = owner; + this.token = token; + } + + public Balance() + { + } + } +} diff --git a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_True_KeepCandidCase_False.snap b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False.snap similarity index 95% rename from test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_True_KeepCandidCase_False.snap rename to test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False.snap index 4c6404c4..34e52ac8 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_True_KeepCandidCase_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False.snap @@ -136,7 +136,7 @@ using System; namespace Test.Models { - [Variant(typeof(WithdrawReceiptTag))] + [Variant()] public class WithdrawReceipt { [VariantTagProperty()] @@ -188,9 +188,7 @@ namespace Test.Models public enum WithdrawReceiptTag { - [VariantOptionType(typeof(WithdrawErr))] Err, - [VariantOptionType(typeof(UnboundedUInt))] Ok } } @@ -215,7 +213,7 @@ using System; namespace Test.Models { - [Variant(typeof(OrderPlacementReceiptTag))] + [Variant()] public class OrderPlacementReceipt { [VariantTagProperty()] @@ -267,9 +265,7 @@ namespace Test.Models public enum OrderPlacementReceiptTag { - [VariantOptionType(typeof(OrderPlacementErr))] Err, - [VariantOptionType(typeof(OptionalValue))] Ok } } @@ -339,7 +335,7 @@ using System; namespace Test.Models { - [Variant(typeof(DepositReceiptTag))] + [Variant()] public class DepositReceipt { [VariantTagProperty()] @@ -391,9 +387,7 @@ namespace Test.Models public enum DepositReceiptTag { - [VariantOptionType(typeof(DepositErr))] Err, - [VariantOptionType(typeof(UnboundedUInt))] Ok } } @@ -418,7 +412,7 @@ using OrderId = System.UInt32; namespace Test.Models { - [Variant(typeof(CancelOrderReceiptTag))] + [Variant()] public class CancelOrderReceipt { [VariantTagProperty()] @@ -470,9 +464,7 @@ namespace Test.Models public enum CancelOrderReceiptTag { - [VariantOptionType(typeof(CancelOrderErr))] Err, - [VariantOptionType(typeof(OrderId))] Ok } } diff --git a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True.snap b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True.snap new file mode 100644 index 00000000..8185a087 --- /dev/null +++ b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True.snap @@ -0,0 +1,405 @@ +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; + +namespace Test +{ + public class DexApiClient + { + public IAgent Agent { get; } + + public Principal CanisterId { get; } + + public CandidConverter? Converter { get; } + + public DexApiClient(IAgent agent, Principal canisterId, CandidConverter? converter = default) + { + this.Agent = agent; + this.CanisterId = canisterId; + this.Converter = converter; + } + + public async Task CancelOrder(OrderId arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "cancelOrder", arg); + return reply.ToObjects(this.Converter); + } + + public async Task Clear() + { + CandidArg arg = CandidArg.FromCandid(); + await this.Agent.CallAsync(this.CanisterId, "clear", arg); + } + + public async Task Credit(Principal arg0, Token arg1, UnboundedUInt arg2) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0), CandidTypedValue.FromObject(arg1), CandidTypedValue.FromObject(arg2)); + await this.Agent.CallAsync(this.CanisterId, "credit", arg); + } + + public async Task Deposit(Token arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "deposit", arg); + return reply.ToObjects(this.Converter); + } + + public async Task> GetAllBalances() + { + CandidArg arg = CandidArg.FromCandid(); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "getAllBalances", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects>(this.Converter); + } + + public async Task GetBalance(Token arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "getBalance", arg); + CandidArg reply = response.ThrowOrGetReply(); + 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(); + return reply.ToObjects>(this.Converter); + } + + public async Task> GetDepositAddress() + { + CandidArg arg = CandidArg.FromCandid(); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "getDepositAddress", arg); + return reply.ToObjects>(this.Converter); + } + + public async Task> GetOrder(OrderId arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "getOrder", arg); + return reply.ToObjects>(this.Converter); + } + + public async Task> GetOrders() + { + CandidArg arg = CandidArg.FromCandid(); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "getOrders", arg); + return reply.ToObjects>(this.Converter); + } + + public async Task GetSymbol(Token arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "getSymbol", arg); + return reply.ToObjects(this.Converter); + } + + public async Task PlaceOrder(Token arg0, UnboundedUInt arg1, Token arg2, UnboundedUInt arg3) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0), CandidTypedValue.FromObject(arg1), CandidTypedValue.FromObject(arg2), CandidTypedValue.FromObject(arg3)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "placeOrder", arg); + return reply.ToObjects(this.Converter); + } + + public async Task Whoami() + { + CandidArg arg = CandidArg.FromCandid(); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "whoami", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + + public async Task Withdraw(Token arg0, UnboundedUInt arg1, Principal arg2) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0), CandidTypedValue.FromObject(arg1), CandidTypedValue.FromObject(arg2)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "withdraw", arg); + return reply.ToObjects(this.Converter); + } + } +} + +Type File: 'WithdrawReceipt' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; +using EdjCase.ICP.Candid.Models; + +namespace Test.Models +{ + [Variant()] + public class WithdrawReceipt + { + [VariantTagProperty()] + public WithdrawReceiptTag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public WithdrawErr? Err { get => this.Tag == WithdrawReceiptTag.Err ? (WithdrawErr)this.Value! : default; set => (this.Tag, this.Value) = (WithdrawReceiptTag.Err, value); } + + public UnboundedUInt? Ok { get => this.Tag == WithdrawReceiptTag.Ok ? (UnboundedUInt)this.Value! : default; set => (this.Tag, this.Value) = (WithdrawReceiptTag.Ok, value); } + + public WithdrawReceipt(WithdrawReceiptTag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected WithdrawReceipt() + { + } + } + + public enum WithdrawReceiptTag + { + Err, + Ok + } +} + +Type File: 'WithdrawErr' + +namespace Test.Models +{ + public enum WithdrawErr + { + BalanceLow, + TransferFailure + } +} + +Type File: 'OrderPlacementReceipt' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; +using EdjCase.ICP.Candid.Models; + +namespace Test.Models +{ + [Variant()] + public class OrderPlacementReceipt + { + [VariantTagProperty()] + public OrderPlacementReceiptTag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public OrderPlacementErr? Err { get => this.Tag == OrderPlacementReceiptTag.Err ? (OrderPlacementErr)this.Value! : default; set => (this.Tag, this.Value) = (OrderPlacementReceiptTag.Err, value); } + + public OptionalValue? Ok { get => this.Tag == OrderPlacementReceiptTag.Ok ? (OptionalValue)this.Value! : default; set => (this.Tag, this.Value) = (OrderPlacementReceiptTag.Ok, value); } + + public OrderPlacementReceipt(OrderPlacementReceiptTag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected OrderPlacementReceipt() + { + } + } + + public enum OrderPlacementReceiptTag + { + Err, + Ok + } +} + +Type File: 'OrderPlacementErr' + +namespace Test.Models +{ + public enum OrderPlacementErr + { + InvalidOrder, + OrderBookFull + } +} + +Type File: 'Order' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Token = EdjCase.ICP.Candid.Models.Principal; +using OrderId = System.UInt32; + +namespace Test.Models +{ + public class Order + { + [CandidName("from")] + public Token From { get; set; } + + [CandidName("fromAmount")] + public UnboundedUInt FromAmount { get; set; } + + [CandidName("id")] + public OrderId Id { get; set; } + + [CandidName("owner")] + public Principal Owner { get; set; } + + [CandidName("to")] + public Token To { get; set; } + + [CandidName("toAmount")] + public UnboundedUInt ToAmount { get; set; } + + public Order(Token from, UnboundedUInt fromAmount, OrderId id, Principal owner, Token to, UnboundedUInt toAmount) + { + this.From = from; + this.FromAmount = fromAmount; + this.Id = id; + this.Owner = owner; + this.To = to; + this.ToAmount = toAmount; + } + + public Order() + { + } + } +} + +Type File: 'DepositReceipt' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; +using EdjCase.ICP.Candid.Models; + +namespace Test.Models +{ + [Variant()] + public class DepositReceipt + { + [VariantTagProperty()] + public DepositReceiptTag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public DepositErr? Err { get => this.Tag == DepositReceiptTag.Err ? (DepositErr)this.Value! : default; set => (this.Tag, this.Value) = (DepositReceiptTag.Err, value); } + + public UnboundedUInt? Ok { get => this.Tag == DepositReceiptTag.Ok ? (UnboundedUInt)this.Value! : default; set => (this.Tag, this.Value) = (DepositReceiptTag.Ok, value); } + + public DepositReceipt(DepositReceiptTag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected DepositReceipt() + { + } + } + + public enum DepositReceiptTag + { + Err, + Ok + } +} + +Type File: 'DepositErr' + +namespace Test.Models +{ + public enum DepositErr + { + BalanceLow, + TransferFailure + } +} + +Type File: 'CancelOrderReceipt' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; +using OrderId = System.UInt32; + +namespace Test.Models +{ + [Variant()] + public class CancelOrderReceipt + { + [VariantTagProperty()] + public CancelOrderReceiptTag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public CancelOrderErr? Err { get => this.Tag == CancelOrderReceiptTag.Err ? (CancelOrderErr)this.Value! : default; set => (this.Tag, this.Value) = (CancelOrderReceiptTag.Err, value); } + + public OrderId? Ok { get => this.Tag == CancelOrderReceiptTag.Ok ? (OrderId)this.Value! : default; set => (this.Tag, this.Value) = (CancelOrderReceiptTag.Ok, value); } + + public CancelOrderReceipt(CancelOrderReceiptTag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected CancelOrderReceipt() + { + } + } + + public enum CancelOrderReceiptTag + { + Err, + Ok + } +} + +Type File: 'CancelOrderErr' + +namespace Test.Models +{ + public enum CancelOrderErr + { + NotAllowed, + NotExistingOrder + } +} + +Type File: 'Balance' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Token = EdjCase.ICP.Candid.Models.Principal; + +namespace Test.Models +{ + public class Balance + { + [CandidName("amount")] + public UnboundedUInt Amount { get; set; } + + [CandidName("owner")] + public Principal Owner { get; set; } + + [CandidName("token")] + public Token Token { get; set; } + + public Balance(UnboundedUInt amount, Principal owner, Token token) + { + this.Amount = amount; + this.Owner = owner; + this.Token = token; + } + + public Balance() + { + } + } +} diff --git a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_True_KeepCandidCase_True.snap b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False.snap similarity index 95% rename from test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_True_KeepCandidCase_True.snap rename to test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False.snap index 5da894d4..004814b3 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_True_KeepCandidCase_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False.snap @@ -136,7 +136,7 @@ using System; namespace Test.Models { - [Variant(typeof(WithdrawReceiptTag))] + [Variant()] public class WithdrawReceipt { [VariantTagProperty()] @@ -188,9 +188,7 @@ namespace Test.Models public enum WithdrawReceiptTag { - [VariantOptionType(typeof(WithdrawErr))] Err, - [VariantOptionType(typeof(UnboundedUInt))] Ok } } @@ -215,7 +213,7 @@ using System; namespace Test.Models { - [Variant(typeof(OrderPlacementReceiptTag))] + [Variant()] public class OrderPlacementReceipt { [VariantTagProperty()] @@ -267,9 +265,7 @@ namespace Test.Models public enum OrderPlacementReceiptTag { - [VariantOptionType(typeof(OrderPlacementErr))] Err, - [VariantOptionType(typeof(OptionalValue))] Ok } } @@ -332,7 +328,7 @@ using System; namespace Test.Models { - [Variant(typeof(DepositReceiptTag))] + [Variant()] public class DepositReceipt { [VariantTagProperty()] @@ -384,9 +380,7 @@ namespace Test.Models public enum DepositReceiptTag { - [VariantOptionType(typeof(DepositErr))] Err, - [VariantOptionType(typeof(UnboundedUInt))] Ok } } @@ -411,7 +405,7 @@ using OrderId = System.UInt32; namespace Test.Models { - [Variant(typeof(CancelOrderReceiptTag))] + [Variant()] public class CancelOrderReceipt { [VariantTagProperty()] @@ -463,9 +457,7 @@ namespace Test.Models public enum CancelOrderReceiptTag { - [VariantOptionType(typeof(CancelOrderErr))] Err, - [VariantOptionType(typeof(OrderId))] Ok } } diff --git a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True.snap b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True.snap new file mode 100644 index 00000000..08b2cac1 --- /dev/null +++ b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True.snap @@ -0,0 +1,394 @@ +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; + +namespace Test +{ + public class DexApiClient + { + public IAgent Agent { get; } + + public Principal CanisterId { get; } + + public CandidConverter? Converter { get; } + + public DexApiClient(IAgent agent, Principal canisterId, CandidConverter? converter = default) + { + this.Agent = agent; + this.CanisterId = canisterId; + this.Converter = converter; + } + + public async Task cancelOrder(OrderId arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "cancelOrder", arg); + return reply.ToObjects(this.Converter); + } + + public async Task clear() + { + CandidArg arg = CandidArg.FromCandid(); + await this.Agent.CallAsync(this.CanisterId, "clear", arg); + } + + public async Task credit(Principal arg0, Token arg1, UnboundedUInt arg2) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0), CandidTypedValue.FromObject(arg1), CandidTypedValue.FromObject(arg2)); + await this.Agent.CallAsync(this.CanisterId, "credit", arg); + } + + public async Task deposit(Token arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "deposit", arg); + return reply.ToObjects(this.Converter); + } + + public async Task> getAllBalances() + { + CandidArg arg = CandidArg.FromCandid(); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "getAllBalances", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects>(this.Converter); + } + + public async Task getBalance(Token arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "getBalance", arg); + CandidArg reply = response.ThrowOrGetReply(); + 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(); + return reply.ToObjects>(this.Converter); + } + + public async Task> getDepositAddress() + { + CandidArg arg = CandidArg.FromCandid(); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "getDepositAddress", arg); + return reply.ToObjects>(this.Converter); + } + + public async Task> getOrder(OrderId arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "getOrder", arg); + return reply.ToObjects>(this.Converter); + } + + public async Task> getOrders() + { + CandidArg arg = CandidArg.FromCandid(); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "getOrders", arg); + return reply.ToObjects>(this.Converter); + } + + public async Task getSymbol(Token arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "getSymbol", arg); + return reply.ToObjects(this.Converter); + } + + public async Task placeOrder(Token arg0, UnboundedUInt arg1, Token arg2, UnboundedUInt arg3) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0), CandidTypedValue.FromObject(arg1), CandidTypedValue.FromObject(arg2), CandidTypedValue.FromObject(arg3)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "placeOrder", arg); + return reply.ToObjects(this.Converter); + } + + public async Task whoami() + { + CandidArg arg = CandidArg.FromCandid(); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "whoami", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + + public async Task withdraw(Token arg0, UnboundedUInt arg1, Principal arg2) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0), CandidTypedValue.FromObject(arg1), CandidTypedValue.FromObject(arg2)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "withdraw", arg); + return reply.ToObjects(this.Converter); + } + } +} + +Type File: 'WithdrawReceipt' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; +using EdjCase.ICP.Candid.Models; + +namespace Test.Models +{ + [Variant()] + public class WithdrawReceipt + { + [VariantTagProperty()] + public WithdrawReceiptTag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public WithdrawErr? Err { get => this.Tag == WithdrawReceiptTag.Err ? (WithdrawErr)this.Value! : default; set => (this.Tag, this.Value) = (WithdrawReceiptTag.Err, value); } + + public UnboundedUInt? Ok { get => this.Tag == WithdrawReceiptTag.Ok ? (UnboundedUInt)this.Value! : default; set => (this.Tag, this.Value) = (WithdrawReceiptTag.Ok, value); } + + public WithdrawReceipt(WithdrawReceiptTag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected WithdrawReceipt() + { + } + } + + public enum WithdrawReceiptTag + { + Err, + Ok + } +} + +Type File: 'WithdrawErr' + +namespace Test.Models +{ + public enum WithdrawErr + { + BalanceLow, + TransferFailure + } +} + +Type File: 'OrderPlacementReceipt' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; +using EdjCase.ICP.Candid.Models; + +namespace Test.Models +{ + [Variant()] + public class OrderPlacementReceipt + { + [VariantTagProperty()] + public OrderPlacementReceiptTag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public OrderPlacementErr? Err { get => this.Tag == OrderPlacementReceiptTag.Err ? (OrderPlacementErr)this.Value! : default; set => (this.Tag, this.Value) = (OrderPlacementReceiptTag.Err, value); } + + public OptionalValue? Ok { get => this.Tag == OrderPlacementReceiptTag.Ok ? (OptionalValue)this.Value! : default; set => (this.Tag, this.Value) = (OrderPlacementReceiptTag.Ok, value); } + + public OrderPlacementReceipt(OrderPlacementReceiptTag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected OrderPlacementReceipt() + { + } + } + + public enum OrderPlacementReceiptTag + { + Err, + Ok + } +} + +Type File: 'OrderPlacementErr' + +namespace Test.Models +{ + public enum OrderPlacementErr + { + InvalidOrder, + OrderBookFull + } +} + +Type File: 'Order' + +using EdjCase.ICP.Candid.Models; +using Token = EdjCase.ICP.Candid.Models.Principal; +using OrderId = System.UInt32; + +namespace Test.Models +{ + public class Order + { + public Token from { get; set; } + + public UnboundedUInt fromAmount { get; set; } + + public OrderId id { get; set; } + + public Principal owner { get; set; } + + public Token to { get; set; } + + public UnboundedUInt toAmount { get; set; } + + public Order(Token from, UnboundedUInt fromAmount, OrderId id, Principal owner, Token to, UnboundedUInt toAmount) + { + this.from = from; + this.fromAmount = fromAmount; + this.id = id; + this.owner = owner; + this.to = to; + this.toAmount = toAmount; + } + + public Order() + { + } + } +} + +Type File: 'DepositReceipt' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; +using EdjCase.ICP.Candid.Models; + +namespace Test.Models +{ + [Variant()] + public class DepositReceipt + { + [VariantTagProperty()] + public DepositReceiptTag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public DepositErr? Err { get => this.Tag == DepositReceiptTag.Err ? (DepositErr)this.Value! : default; set => (this.Tag, this.Value) = (DepositReceiptTag.Err, value); } + + public UnboundedUInt? Ok { get => this.Tag == DepositReceiptTag.Ok ? (UnboundedUInt)this.Value! : default; set => (this.Tag, this.Value) = (DepositReceiptTag.Ok, value); } + + public DepositReceipt(DepositReceiptTag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected DepositReceipt() + { + } + } + + public enum DepositReceiptTag + { + Err, + Ok + } +} + +Type File: 'DepositErr' + +namespace Test.Models +{ + public enum DepositErr + { + BalanceLow, + TransferFailure + } +} + +Type File: 'CancelOrderReceipt' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; +using OrderId = System.UInt32; + +namespace Test.Models +{ + [Variant()] + public class CancelOrderReceipt + { + [VariantTagProperty()] + public CancelOrderReceiptTag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public CancelOrderErr? Err { get => this.Tag == CancelOrderReceiptTag.Err ? (CancelOrderErr)this.Value! : default; set => (this.Tag, this.Value) = (CancelOrderReceiptTag.Err, value); } + + public OrderId? Ok { get => this.Tag == CancelOrderReceiptTag.Ok ? (OrderId)this.Value! : default; set => (this.Tag, this.Value) = (CancelOrderReceiptTag.Ok, value); } + + public CancelOrderReceipt(CancelOrderReceiptTag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected CancelOrderReceipt() + { + } + } + + public enum CancelOrderReceiptTag + { + Err, + Ok + } +} + +Type File: 'CancelOrderErr' + +namespace Test.Models +{ + public enum CancelOrderErr + { + NotAllowed, + NotExistingOrder + } +} + +Type File: 'Balance' + +using EdjCase.ICP.Candid.Models; +using Token = EdjCase.ICP.Candid.Models.Principal; + +namespace Test.Models +{ + public class Balance + { + public UnboundedUInt amount { get; set; } + + public Principal owner { get; set; } + + public Token token { get; set; } + + public Balance(UnboundedUInt amount, Principal owner, Token token) + { + this.amount = amount; + this.owner = owner; + this.token = token; + } + + public Balance() + { + } + } +} diff --git a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_False_KeepCandidCase_False.snap b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False.snap similarity index 95% rename from test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_False_KeepCandidCase_False.snap rename to test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False.snap index 01e2ecb0..f07476f8 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_False_KeepCandidCase_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False.snap @@ -136,7 +136,7 @@ using System; namespace Test { - [Variant(typeof(WithdrawReceiptTag))] + [Variant()] public class WithdrawReceipt { [VariantTagProperty()] @@ -188,9 +188,7 @@ namespace Test public enum WithdrawReceiptTag { - [VariantOptionType(typeof(WithdrawErr))] Err, - [VariantOptionType(typeof(UnboundedUInt))] Ok } } @@ -215,7 +213,7 @@ using System; namespace Test { - [Variant(typeof(OrderPlacementReceiptTag))] + [Variant()] public class OrderPlacementReceipt { [VariantTagProperty()] @@ -267,9 +265,7 @@ namespace Test public enum OrderPlacementReceiptTag { - [VariantOptionType(typeof(OrderPlacementErr))] Err, - [VariantOptionType(typeof(OptionalValue))] Ok } } @@ -339,7 +335,7 @@ using System; namespace Test { - [Variant(typeof(DepositReceiptTag))] + [Variant()] public class DepositReceipt { [VariantTagProperty()] @@ -391,9 +387,7 @@ namespace Test public enum DepositReceiptTag { - [VariantOptionType(typeof(DepositErr))] Err, - [VariantOptionType(typeof(UnboundedUInt))] Ok } } @@ -418,7 +412,7 @@ using OrderId = System.UInt32; namespace Test { - [Variant(typeof(CancelOrderReceiptTag))] + [Variant()] public class CancelOrderReceipt { [VariantTagProperty()] @@ -470,9 +464,7 @@ namespace Test public enum CancelOrderReceiptTag { - [VariantOptionType(typeof(CancelOrderErr))] Err, - [VariantOptionType(typeof(OrderId))] Ok } } diff --git a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True.snap b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True.snap new file mode 100644 index 00000000..92d7d8cc --- /dev/null +++ b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True.snap @@ -0,0 +1,405 @@ +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; + +namespace Test +{ + public class DexApiClient + { + public IAgent Agent { get; } + + public Principal CanisterId { get; } + + public CandidConverter Converter { get; } + + public DexApiClient(IAgent agent, Principal canisterId, CandidConverter converter = default) + { + this.Agent = agent; + this.CanisterId = canisterId; + this.Converter = converter; + } + + public async Task CancelOrder(OrderId arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "cancelOrder", arg); + return reply.ToObjects(this.Converter); + } + + public async Task Clear() + { + CandidArg arg = CandidArg.FromCandid(); + await this.Agent.CallAsync(this.CanisterId, "clear", arg); + } + + public async Task Credit(Principal arg0, Token arg1, UnboundedUInt arg2) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0), CandidTypedValue.FromObject(arg1), CandidTypedValue.FromObject(arg2)); + await this.Agent.CallAsync(this.CanisterId, "credit", arg); + } + + public async Task Deposit(Token arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "deposit", arg); + return reply.ToObjects(this.Converter); + } + + public async Task> GetAllBalances() + { + CandidArg arg = CandidArg.FromCandid(); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "getAllBalances", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects>(this.Converter); + } + + public async Task GetBalance(Token arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "getBalance", arg); + CandidArg reply = response.ThrowOrGetReply(); + 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(); + return reply.ToObjects>(this.Converter); + } + + public async Task> GetDepositAddress() + { + CandidArg arg = CandidArg.FromCandid(); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "getDepositAddress", arg); + return reply.ToObjects>(this.Converter); + } + + public async Task> GetOrder(OrderId arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "getOrder", arg); + return reply.ToObjects>(this.Converter); + } + + public async Task> GetOrders() + { + CandidArg arg = CandidArg.FromCandid(); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "getOrders", arg); + return reply.ToObjects>(this.Converter); + } + + public async Task GetSymbol(Token arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "getSymbol", arg); + return reply.ToObjects(this.Converter); + } + + public async Task PlaceOrder(Token arg0, UnboundedUInt arg1, Token arg2, UnboundedUInt arg3) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0), CandidTypedValue.FromObject(arg1), CandidTypedValue.FromObject(arg2), CandidTypedValue.FromObject(arg3)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "placeOrder", arg); + return reply.ToObjects(this.Converter); + } + + public async Task Whoami() + { + CandidArg arg = CandidArg.FromCandid(); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "whoami", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + + public async Task Withdraw(Token arg0, UnboundedUInt arg1, Principal arg2) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0), CandidTypedValue.FromObject(arg1), CandidTypedValue.FromObject(arg2)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "withdraw", arg); + return reply.ToObjects(this.Converter); + } + } +} + +Type File: 'WithdrawReceipt' + +using EdjCase.ICP.Candid.Mapping; +using Test; +using EdjCase.ICP.Candid.Models; + +namespace Test +{ + [Variant()] + public class WithdrawReceipt + { + [VariantTagProperty()] + public WithdrawReceiptTag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public WithdrawErr Err { get => this.Tag == WithdrawReceiptTag.Err ? (WithdrawErr)this.Value! : default; set => (this.Tag, this.Value) = (WithdrawReceiptTag.Err, value); } + + public UnboundedUInt Ok { get => this.Tag == WithdrawReceiptTag.Ok ? (UnboundedUInt)this.Value! : default; set => (this.Tag, this.Value) = (WithdrawReceiptTag.Ok, value); } + + public WithdrawReceipt(WithdrawReceiptTag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected WithdrawReceipt() + { + } + } + + public enum WithdrawReceiptTag + { + Err, + Ok + } +} + +Type File: 'WithdrawErr' + +namespace Test +{ + public enum WithdrawErr + { + BalanceLow, + TransferFailure + } +} + +Type File: 'OrderPlacementReceipt' + +using EdjCase.ICP.Candid.Mapping; +using Test; +using EdjCase.ICP.Candid.Models; + +namespace Test +{ + [Variant()] + public class OrderPlacementReceipt + { + [VariantTagProperty()] + public OrderPlacementReceiptTag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public OrderPlacementErr Err { get => this.Tag == OrderPlacementReceiptTag.Err ? (OrderPlacementErr)this.Value! : default; set => (this.Tag, this.Value) = (OrderPlacementReceiptTag.Err, value); } + + public OptionalValue Ok { get => this.Tag == OrderPlacementReceiptTag.Ok ? (OptionalValue)this.Value! : default; set => (this.Tag, this.Value) = (OrderPlacementReceiptTag.Ok, value); } + + public OrderPlacementReceipt(OrderPlacementReceiptTag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected OrderPlacementReceipt() + { + } + } + + public enum OrderPlacementReceiptTag + { + Err, + Ok + } +} + +Type File: 'OrderPlacementErr' + +namespace Test +{ + public enum OrderPlacementErr + { + InvalidOrder, + OrderBookFull + } +} + +Type File: 'Order' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Token = EdjCase.ICP.Candid.Models.Principal; +using OrderId = System.UInt32; + +namespace Test +{ + public class Order + { + [CandidName("from")] + public Token From { get; set; } + + [CandidName("fromAmount")] + public UnboundedUInt FromAmount { get; set; } + + [CandidName("id")] + public OrderId Id { get; set; } + + [CandidName("owner")] + public Principal Owner { get; set; } + + [CandidName("to")] + public Token To { get; set; } + + [CandidName("toAmount")] + public UnboundedUInt ToAmount { get; set; } + + public Order(Token from, UnboundedUInt fromAmount, OrderId id, Principal owner, Token to, UnboundedUInt toAmount) + { + this.From = from; + this.FromAmount = fromAmount; + this.Id = id; + this.Owner = owner; + this.To = to; + this.ToAmount = toAmount; + } + + public Order() + { + } + } +} + +Type File: 'DepositReceipt' + +using EdjCase.ICP.Candid.Mapping; +using Test; +using EdjCase.ICP.Candid.Models; + +namespace Test +{ + [Variant()] + public class DepositReceipt + { + [VariantTagProperty()] + public DepositReceiptTag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public DepositErr Err { get => this.Tag == DepositReceiptTag.Err ? (DepositErr)this.Value! : default; set => (this.Tag, this.Value) = (DepositReceiptTag.Err, value); } + + public UnboundedUInt Ok { get => this.Tag == DepositReceiptTag.Ok ? (UnboundedUInt)this.Value! : default; set => (this.Tag, this.Value) = (DepositReceiptTag.Ok, value); } + + public DepositReceipt(DepositReceiptTag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected DepositReceipt() + { + } + } + + public enum DepositReceiptTag + { + Err, + Ok + } +} + +Type File: 'DepositErr' + +namespace Test +{ + public enum DepositErr + { + BalanceLow, + TransferFailure + } +} + +Type File: 'CancelOrderReceipt' + +using EdjCase.ICP.Candid.Mapping; +using Test; +using OrderId = System.UInt32; + +namespace Test +{ + [Variant()] + public class CancelOrderReceipt + { + [VariantTagProperty()] + public CancelOrderReceiptTag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public CancelOrderErr Err { get => this.Tag == CancelOrderReceiptTag.Err ? (CancelOrderErr)this.Value! : default; set => (this.Tag, this.Value) = (CancelOrderReceiptTag.Err, value); } + + public OrderId Ok { get => this.Tag == CancelOrderReceiptTag.Ok ? (OrderId)this.Value! : default; set => (this.Tag, this.Value) = (CancelOrderReceiptTag.Ok, value); } + + public CancelOrderReceipt(CancelOrderReceiptTag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected CancelOrderReceipt() + { + } + } + + public enum CancelOrderReceiptTag + { + Err, + Ok + } +} + +Type File: 'CancelOrderErr' + +namespace Test +{ + public enum CancelOrderErr + { + NotAllowed, + NotExistingOrder + } +} + +Type File: 'Balance' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Token = EdjCase.ICP.Candid.Models.Principal; + +namespace Test +{ + public class Balance + { + [CandidName("amount")] + public UnboundedUInt Amount { get; set; } + + [CandidName("owner")] + public Principal Owner { get; set; } + + [CandidName("token")] + public Token Token { get; set; } + + public Balance(UnboundedUInt amount, Principal owner, Token token) + { + this.Amount = amount; + this.Owner = owner; + this.Token = token; + } + + public Balance() + { + } + } +} diff --git a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_False_KeepCandidCase_True.snap b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False.snap similarity index 95% rename from test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_False_KeepCandidCase_True.snap rename to test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False.snap index 90baba40..ce4ef123 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_False_KeepCandidCase_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False.snap @@ -136,7 +136,7 @@ using System; namespace Test { - [Variant(typeof(WithdrawReceiptTag))] + [Variant()] public class WithdrawReceipt { [VariantTagProperty()] @@ -188,9 +188,7 @@ namespace Test public enum WithdrawReceiptTag { - [VariantOptionType(typeof(WithdrawErr))] Err, - [VariantOptionType(typeof(UnboundedUInt))] Ok } } @@ -215,7 +213,7 @@ using System; namespace Test { - [Variant(typeof(OrderPlacementReceiptTag))] + [Variant()] public class OrderPlacementReceipt { [VariantTagProperty()] @@ -267,9 +265,7 @@ namespace Test public enum OrderPlacementReceiptTag { - [VariantOptionType(typeof(OrderPlacementErr))] Err, - [VariantOptionType(typeof(OptionalValue))] Ok } } @@ -332,7 +328,7 @@ using System; namespace Test { - [Variant(typeof(DepositReceiptTag))] + [Variant()] public class DepositReceipt { [VariantTagProperty()] @@ -384,9 +380,7 @@ namespace Test public enum DepositReceiptTag { - [VariantOptionType(typeof(DepositErr))] Err, - [VariantOptionType(typeof(UnboundedUInt))] Ok } } @@ -411,7 +405,7 @@ using OrderId = System.UInt32; namespace Test { - [Variant(typeof(CancelOrderReceiptTag))] + [Variant()] public class CancelOrderReceipt { [VariantTagProperty()] @@ -463,9 +457,7 @@ namespace Test public enum CancelOrderReceiptTag { - [VariantOptionType(typeof(CancelOrderErr))] Err, - [VariantOptionType(typeof(OrderId))] Ok } } diff --git a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True.snap b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True.snap new file mode 100644 index 00000000..b801ae51 --- /dev/null +++ b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True.snap @@ -0,0 +1,394 @@ +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; + +namespace Test +{ + public class DexApiClient + { + public IAgent Agent { get; } + + public Principal CanisterId { get; } + + public CandidConverter Converter { get; } + + public DexApiClient(IAgent agent, Principal canisterId, CandidConverter converter = default) + { + this.Agent = agent; + this.CanisterId = canisterId; + this.Converter = converter; + } + + public async Task cancelOrder(OrderId arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "cancelOrder", arg); + return reply.ToObjects(this.Converter); + } + + public async Task clear() + { + CandidArg arg = CandidArg.FromCandid(); + await this.Agent.CallAsync(this.CanisterId, "clear", arg); + } + + public async Task credit(Principal arg0, Token arg1, UnboundedUInt arg2) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0), CandidTypedValue.FromObject(arg1), CandidTypedValue.FromObject(arg2)); + await this.Agent.CallAsync(this.CanisterId, "credit", arg); + } + + public async Task deposit(Token arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "deposit", arg); + return reply.ToObjects(this.Converter); + } + + public async Task> getAllBalances() + { + CandidArg arg = CandidArg.FromCandid(); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "getAllBalances", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects>(this.Converter); + } + + public async Task getBalance(Token arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "getBalance", arg); + CandidArg reply = response.ThrowOrGetReply(); + 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(); + return reply.ToObjects>(this.Converter); + } + + public async Task> getDepositAddress() + { + CandidArg arg = CandidArg.FromCandid(); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "getDepositAddress", arg); + return reply.ToObjects>(this.Converter); + } + + public async Task> getOrder(OrderId arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "getOrder", arg); + return reply.ToObjects>(this.Converter); + } + + public async Task> getOrders() + { + CandidArg arg = CandidArg.FromCandid(); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "getOrders", arg); + return reply.ToObjects>(this.Converter); + } + + public async Task getSymbol(Token arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "getSymbol", arg); + return reply.ToObjects(this.Converter); + } + + public async Task placeOrder(Token arg0, UnboundedUInt arg1, Token arg2, UnboundedUInt arg3) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0), CandidTypedValue.FromObject(arg1), CandidTypedValue.FromObject(arg2), CandidTypedValue.FromObject(arg3)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "placeOrder", arg); + return reply.ToObjects(this.Converter); + } + + public async Task whoami() + { + CandidArg arg = CandidArg.FromCandid(); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "whoami", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + + public async Task withdraw(Token arg0, UnboundedUInt arg1, Principal arg2) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0), CandidTypedValue.FromObject(arg1), CandidTypedValue.FromObject(arg2)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "withdraw", arg); + return reply.ToObjects(this.Converter); + } + } +} + +Type File: 'WithdrawReceipt' + +using EdjCase.ICP.Candid.Mapping; +using Test; +using EdjCase.ICP.Candid.Models; + +namespace Test +{ + [Variant()] + public class WithdrawReceipt + { + [VariantTagProperty()] + public WithdrawReceiptTag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public WithdrawErr Err { get => this.Tag == WithdrawReceiptTag.Err ? (WithdrawErr)this.Value! : default; set => (this.Tag, this.Value) = (WithdrawReceiptTag.Err, value); } + + public UnboundedUInt Ok { get => this.Tag == WithdrawReceiptTag.Ok ? (UnboundedUInt)this.Value! : default; set => (this.Tag, this.Value) = (WithdrawReceiptTag.Ok, value); } + + public WithdrawReceipt(WithdrawReceiptTag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected WithdrawReceipt() + { + } + } + + public enum WithdrawReceiptTag + { + Err, + Ok + } +} + +Type File: 'WithdrawErr' + +namespace Test +{ + public enum WithdrawErr + { + BalanceLow, + TransferFailure + } +} + +Type File: 'OrderPlacementReceipt' + +using EdjCase.ICP.Candid.Mapping; +using Test; +using EdjCase.ICP.Candid.Models; + +namespace Test +{ + [Variant()] + public class OrderPlacementReceipt + { + [VariantTagProperty()] + public OrderPlacementReceiptTag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public OrderPlacementErr Err { get => this.Tag == OrderPlacementReceiptTag.Err ? (OrderPlacementErr)this.Value! : default; set => (this.Tag, this.Value) = (OrderPlacementReceiptTag.Err, value); } + + public OptionalValue Ok { get => this.Tag == OrderPlacementReceiptTag.Ok ? (OptionalValue)this.Value! : default; set => (this.Tag, this.Value) = (OrderPlacementReceiptTag.Ok, value); } + + public OrderPlacementReceipt(OrderPlacementReceiptTag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected OrderPlacementReceipt() + { + } + } + + public enum OrderPlacementReceiptTag + { + Err, + Ok + } +} + +Type File: 'OrderPlacementErr' + +namespace Test +{ + public enum OrderPlacementErr + { + InvalidOrder, + OrderBookFull + } +} + +Type File: 'Order' + +using EdjCase.ICP.Candid.Models; +using Token = EdjCase.ICP.Candid.Models.Principal; +using OrderId = System.UInt32; + +namespace Test +{ + public class Order + { + public Token from { get; set; } + + public UnboundedUInt fromAmount { get; set; } + + public OrderId id { get; set; } + + public Principal owner { get; set; } + + public Token to { get; set; } + + public UnboundedUInt toAmount { get; set; } + + public Order(Token from, UnboundedUInt fromAmount, OrderId id, Principal owner, Token to, UnboundedUInt toAmount) + { + this.from = from; + this.fromAmount = fromAmount; + this.id = id; + this.owner = owner; + this.to = to; + this.toAmount = toAmount; + } + + public Order() + { + } + } +} + +Type File: 'DepositReceipt' + +using EdjCase.ICP.Candid.Mapping; +using Test; +using EdjCase.ICP.Candid.Models; + +namespace Test +{ + [Variant()] + public class DepositReceipt + { + [VariantTagProperty()] + public DepositReceiptTag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public DepositErr Err { get => this.Tag == DepositReceiptTag.Err ? (DepositErr)this.Value! : default; set => (this.Tag, this.Value) = (DepositReceiptTag.Err, value); } + + public UnboundedUInt Ok { get => this.Tag == DepositReceiptTag.Ok ? (UnboundedUInt)this.Value! : default; set => (this.Tag, this.Value) = (DepositReceiptTag.Ok, value); } + + public DepositReceipt(DepositReceiptTag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected DepositReceipt() + { + } + } + + public enum DepositReceiptTag + { + Err, + Ok + } +} + +Type File: 'DepositErr' + +namespace Test +{ + public enum DepositErr + { + BalanceLow, + TransferFailure + } +} + +Type File: 'CancelOrderReceipt' + +using EdjCase.ICP.Candid.Mapping; +using Test; +using OrderId = System.UInt32; + +namespace Test +{ + [Variant()] + public class CancelOrderReceipt + { + [VariantTagProperty()] + public CancelOrderReceiptTag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public CancelOrderErr Err { get => this.Tag == CancelOrderReceiptTag.Err ? (CancelOrderErr)this.Value! : default; set => (this.Tag, this.Value) = (CancelOrderReceiptTag.Err, value); } + + public OrderId Ok { get => this.Tag == CancelOrderReceiptTag.Ok ? (OrderId)this.Value! : default; set => (this.Tag, this.Value) = (CancelOrderReceiptTag.Ok, value); } + + public CancelOrderReceipt(CancelOrderReceiptTag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected CancelOrderReceipt() + { + } + } + + public enum CancelOrderReceiptTag + { + Err, + Ok + } +} + +Type File: 'CancelOrderErr' + +namespace Test +{ + public enum CancelOrderErr + { + NotAllowed, + NotExistingOrder + } +} + +Type File: 'Balance' + +using EdjCase.ICP.Candid.Models; +using Token = EdjCase.ICP.Candid.Models.Principal; + +namespace Test +{ + public class Balance + { + public UnboundedUInt amount { get; set; } + + public Principal owner { get; set; } + + public Token token { get; set; } + + public Balance(UnboundedUInt amount, Principal owner, Token token) + { + this.amount = amount; + this.owner = owner; + this.token = token; + } + + public Balance() + { + } + } +} diff --git a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_True_KeepCandidCase_False.snap b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False.snap similarity index 95% rename from test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_True_KeepCandidCase_False.snap rename to test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False.snap index 411b151e..5a6b4eac 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_True_KeepCandidCase_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False.snap @@ -136,7 +136,7 @@ using System; namespace Test { - [Variant(typeof(WithdrawReceiptTag))] + [Variant()] public class WithdrawReceipt { [VariantTagProperty()] @@ -188,9 +188,7 @@ namespace Test public enum WithdrawReceiptTag { - [VariantOptionType(typeof(WithdrawErr))] Err, - [VariantOptionType(typeof(UnboundedUInt))] Ok } } @@ -215,7 +213,7 @@ using System; namespace Test { - [Variant(typeof(OrderPlacementReceiptTag))] + [Variant()] public class OrderPlacementReceipt { [VariantTagProperty()] @@ -267,9 +265,7 @@ namespace Test public enum OrderPlacementReceiptTag { - [VariantOptionType(typeof(OrderPlacementErr))] Err, - [VariantOptionType(typeof(OptionalValue))] Ok } } @@ -339,7 +335,7 @@ using System; namespace Test { - [Variant(typeof(DepositReceiptTag))] + [Variant()] public class DepositReceipt { [VariantTagProperty()] @@ -391,9 +387,7 @@ namespace Test public enum DepositReceiptTag { - [VariantOptionType(typeof(DepositErr))] Err, - [VariantOptionType(typeof(UnboundedUInt))] Ok } } @@ -418,7 +412,7 @@ using OrderId = System.UInt32; namespace Test { - [Variant(typeof(CancelOrderReceiptTag))] + [Variant()] public class CancelOrderReceipt { [VariantTagProperty()] @@ -470,9 +464,7 @@ namespace Test public enum CancelOrderReceiptTag { - [VariantOptionType(typeof(CancelOrderErr))] Err, - [VariantOptionType(typeof(OrderId))] Ok } } diff --git a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True.snap b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True.snap new file mode 100644 index 00000000..fb4e3898 --- /dev/null +++ b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True.snap @@ -0,0 +1,405 @@ +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; + +namespace Test +{ + public class DexApiClient + { + public IAgent Agent { get; } + + public Principal CanisterId { get; } + + public CandidConverter? Converter { get; } + + public DexApiClient(IAgent agent, Principal canisterId, CandidConverter? converter = default) + { + this.Agent = agent; + this.CanisterId = canisterId; + this.Converter = converter; + } + + public async Task CancelOrder(OrderId arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "cancelOrder", arg); + return reply.ToObjects(this.Converter); + } + + public async Task Clear() + { + CandidArg arg = CandidArg.FromCandid(); + await this.Agent.CallAsync(this.CanisterId, "clear", arg); + } + + public async Task Credit(Principal arg0, Token arg1, UnboundedUInt arg2) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0), CandidTypedValue.FromObject(arg1), CandidTypedValue.FromObject(arg2)); + await this.Agent.CallAsync(this.CanisterId, "credit", arg); + } + + public async Task Deposit(Token arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "deposit", arg); + return reply.ToObjects(this.Converter); + } + + public async Task> GetAllBalances() + { + CandidArg arg = CandidArg.FromCandid(); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "getAllBalances", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects>(this.Converter); + } + + public async Task GetBalance(Token arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "getBalance", arg); + CandidArg reply = response.ThrowOrGetReply(); + 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(); + return reply.ToObjects>(this.Converter); + } + + public async Task> GetDepositAddress() + { + CandidArg arg = CandidArg.FromCandid(); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "getDepositAddress", arg); + return reply.ToObjects>(this.Converter); + } + + public async Task> GetOrder(OrderId arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "getOrder", arg); + return reply.ToObjects>(this.Converter); + } + + public async Task> GetOrders() + { + CandidArg arg = CandidArg.FromCandid(); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "getOrders", arg); + return reply.ToObjects>(this.Converter); + } + + public async Task GetSymbol(Token arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "getSymbol", arg); + return reply.ToObjects(this.Converter); + } + + public async Task PlaceOrder(Token arg0, UnboundedUInt arg1, Token arg2, UnboundedUInt arg3) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0), CandidTypedValue.FromObject(arg1), CandidTypedValue.FromObject(arg2), CandidTypedValue.FromObject(arg3)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "placeOrder", arg); + return reply.ToObjects(this.Converter); + } + + public async Task Whoami() + { + CandidArg arg = CandidArg.FromCandid(); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "whoami", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + + public async Task Withdraw(Token arg0, UnboundedUInt arg1, Principal arg2) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0), CandidTypedValue.FromObject(arg1), CandidTypedValue.FromObject(arg2)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "withdraw", arg); + return reply.ToObjects(this.Converter); + } + } +} + +Type File: 'WithdrawReceipt' + +using EdjCase.ICP.Candid.Mapping; +using Test; +using EdjCase.ICP.Candid.Models; + +namespace Test +{ + [Variant()] + public class WithdrawReceipt + { + [VariantTagProperty()] + public WithdrawReceiptTag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public WithdrawErr? Err { get => this.Tag == WithdrawReceiptTag.Err ? (WithdrawErr)this.Value! : default; set => (this.Tag, this.Value) = (WithdrawReceiptTag.Err, value); } + + public UnboundedUInt? Ok { get => this.Tag == WithdrawReceiptTag.Ok ? (UnboundedUInt)this.Value! : default; set => (this.Tag, this.Value) = (WithdrawReceiptTag.Ok, value); } + + public WithdrawReceipt(WithdrawReceiptTag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected WithdrawReceipt() + { + } + } + + public enum WithdrawReceiptTag + { + Err, + Ok + } +} + +Type File: 'WithdrawErr' + +namespace Test +{ + public enum WithdrawErr + { + BalanceLow, + TransferFailure + } +} + +Type File: 'OrderPlacementReceipt' + +using EdjCase.ICP.Candid.Mapping; +using Test; +using EdjCase.ICP.Candid.Models; + +namespace Test +{ + [Variant()] + public class OrderPlacementReceipt + { + [VariantTagProperty()] + public OrderPlacementReceiptTag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public OrderPlacementErr? Err { get => this.Tag == OrderPlacementReceiptTag.Err ? (OrderPlacementErr)this.Value! : default; set => (this.Tag, this.Value) = (OrderPlacementReceiptTag.Err, value); } + + public OptionalValue? Ok { get => this.Tag == OrderPlacementReceiptTag.Ok ? (OptionalValue)this.Value! : default; set => (this.Tag, this.Value) = (OrderPlacementReceiptTag.Ok, value); } + + public OrderPlacementReceipt(OrderPlacementReceiptTag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected OrderPlacementReceipt() + { + } + } + + public enum OrderPlacementReceiptTag + { + Err, + Ok + } +} + +Type File: 'OrderPlacementErr' + +namespace Test +{ + public enum OrderPlacementErr + { + InvalidOrder, + OrderBookFull + } +} + +Type File: 'Order' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Token = EdjCase.ICP.Candid.Models.Principal; +using OrderId = System.UInt32; + +namespace Test +{ + public class Order + { + [CandidName("from")] + public Token From { get; set; } + + [CandidName("fromAmount")] + public UnboundedUInt FromAmount { get; set; } + + [CandidName("id")] + public OrderId Id { get; set; } + + [CandidName("owner")] + public Principal Owner { get; set; } + + [CandidName("to")] + public Token To { get; set; } + + [CandidName("toAmount")] + public UnboundedUInt ToAmount { get; set; } + + public Order(Token from, UnboundedUInt fromAmount, OrderId id, Principal owner, Token to, UnboundedUInt toAmount) + { + this.From = from; + this.FromAmount = fromAmount; + this.Id = id; + this.Owner = owner; + this.To = to; + this.ToAmount = toAmount; + } + + public Order() + { + } + } +} + +Type File: 'DepositReceipt' + +using EdjCase.ICP.Candid.Mapping; +using Test; +using EdjCase.ICP.Candid.Models; + +namespace Test +{ + [Variant()] + public class DepositReceipt + { + [VariantTagProperty()] + public DepositReceiptTag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public DepositErr? Err { get => this.Tag == DepositReceiptTag.Err ? (DepositErr)this.Value! : default; set => (this.Tag, this.Value) = (DepositReceiptTag.Err, value); } + + public UnboundedUInt? Ok { get => this.Tag == DepositReceiptTag.Ok ? (UnboundedUInt)this.Value! : default; set => (this.Tag, this.Value) = (DepositReceiptTag.Ok, value); } + + public DepositReceipt(DepositReceiptTag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected DepositReceipt() + { + } + } + + public enum DepositReceiptTag + { + Err, + Ok + } +} + +Type File: 'DepositErr' + +namespace Test +{ + public enum DepositErr + { + BalanceLow, + TransferFailure + } +} + +Type File: 'CancelOrderReceipt' + +using EdjCase.ICP.Candid.Mapping; +using Test; +using OrderId = System.UInt32; + +namespace Test +{ + [Variant()] + public class CancelOrderReceipt + { + [VariantTagProperty()] + public CancelOrderReceiptTag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public CancelOrderErr? Err { get => this.Tag == CancelOrderReceiptTag.Err ? (CancelOrderErr)this.Value! : default; set => (this.Tag, this.Value) = (CancelOrderReceiptTag.Err, value); } + + public OrderId? Ok { get => this.Tag == CancelOrderReceiptTag.Ok ? (OrderId)this.Value! : default; set => (this.Tag, this.Value) = (CancelOrderReceiptTag.Ok, value); } + + public CancelOrderReceipt(CancelOrderReceiptTag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected CancelOrderReceipt() + { + } + } + + public enum CancelOrderReceiptTag + { + Err, + Ok + } +} + +Type File: 'CancelOrderErr' + +namespace Test +{ + public enum CancelOrderErr + { + NotAllowed, + NotExistingOrder + } +} + +Type File: 'Balance' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Token = EdjCase.ICP.Candid.Models.Principal; + +namespace Test +{ + public class Balance + { + [CandidName("amount")] + public UnboundedUInt Amount { get; set; } + + [CandidName("owner")] + public Principal Owner { get; set; } + + [CandidName("token")] + public Token Token { get; set; } + + public Balance(UnboundedUInt amount, Principal owner, Token token) + { + this.Amount = amount; + this.Owner = owner; + this.Token = token; + } + + public Balance() + { + } + } +} diff --git a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_True_KeepCandidCase_True.snap b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False.snap similarity index 95% rename from test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_True_KeepCandidCase_True.snap rename to test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False.snap index 69abc387..aab98794 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_True_KeepCandidCase_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False.snap @@ -136,7 +136,7 @@ using System; namespace Test { - [Variant(typeof(WithdrawReceiptTag))] + [Variant()] public class WithdrawReceipt { [VariantTagProperty()] @@ -188,9 +188,7 @@ namespace Test public enum WithdrawReceiptTag { - [VariantOptionType(typeof(WithdrawErr))] Err, - [VariantOptionType(typeof(UnboundedUInt))] Ok } } @@ -215,7 +213,7 @@ using System; namespace Test { - [Variant(typeof(OrderPlacementReceiptTag))] + [Variant()] public class OrderPlacementReceipt { [VariantTagProperty()] @@ -267,9 +265,7 @@ namespace Test public enum OrderPlacementReceiptTag { - [VariantOptionType(typeof(OrderPlacementErr))] Err, - [VariantOptionType(typeof(OptionalValue))] Ok } } @@ -332,7 +328,7 @@ using System; namespace Test { - [Variant(typeof(DepositReceiptTag))] + [Variant()] public class DepositReceipt { [VariantTagProperty()] @@ -384,9 +380,7 @@ namespace Test public enum DepositReceiptTag { - [VariantOptionType(typeof(DepositErr))] Err, - [VariantOptionType(typeof(UnboundedUInt))] Ok } } @@ -411,7 +405,7 @@ using OrderId = System.UInt32; namespace Test { - [Variant(typeof(CancelOrderReceiptTag))] + [Variant()] public class CancelOrderReceipt { [VariantTagProperty()] @@ -463,9 +457,7 @@ namespace Test public enum CancelOrderReceiptTag { - [VariantOptionType(typeof(CancelOrderErr))] Err, - [VariantOptionType(typeof(OrderId))] Ok } } diff --git a/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True.snap b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True.snap new file mode 100644 index 00000000..795aea1b --- /dev/null +++ b/test/Candid.Tests/Generators/__snapshots__/Dex_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True.snap @@ -0,0 +1,394 @@ +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; + +namespace Test +{ + public class DexApiClient + { + public IAgent Agent { get; } + + public Principal CanisterId { get; } + + public CandidConverter? Converter { get; } + + public DexApiClient(IAgent agent, Principal canisterId, CandidConverter? converter = default) + { + this.Agent = agent; + this.CanisterId = canisterId; + this.Converter = converter; + } + + public async Task cancelOrder(OrderId arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "cancelOrder", arg); + return reply.ToObjects(this.Converter); + } + + public async Task clear() + { + CandidArg arg = CandidArg.FromCandid(); + await this.Agent.CallAsync(this.CanisterId, "clear", arg); + } + + public async Task credit(Principal arg0, Token arg1, UnboundedUInt arg2) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0), CandidTypedValue.FromObject(arg1), CandidTypedValue.FromObject(arg2)); + await this.Agent.CallAsync(this.CanisterId, "credit", arg); + } + + public async Task deposit(Token arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "deposit", arg); + return reply.ToObjects(this.Converter); + } + + public async Task> getAllBalances() + { + CandidArg arg = CandidArg.FromCandid(); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "getAllBalances", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects>(this.Converter); + } + + public async Task getBalance(Token arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "getBalance", arg); + CandidArg reply = response.ThrowOrGetReply(); + 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(); + return reply.ToObjects>(this.Converter); + } + + public async Task> getDepositAddress() + { + CandidArg arg = CandidArg.FromCandid(); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "getDepositAddress", arg); + return reply.ToObjects>(this.Converter); + } + + public async Task> getOrder(OrderId arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "getOrder", arg); + return reply.ToObjects>(this.Converter); + } + + public async Task> getOrders() + { + CandidArg arg = CandidArg.FromCandid(); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "getOrders", arg); + return reply.ToObjects>(this.Converter); + } + + public async Task getSymbol(Token arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "getSymbol", arg); + return reply.ToObjects(this.Converter); + } + + public async Task placeOrder(Token arg0, UnboundedUInt arg1, Token arg2, UnboundedUInt arg3) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0), CandidTypedValue.FromObject(arg1), CandidTypedValue.FromObject(arg2), CandidTypedValue.FromObject(arg3)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "placeOrder", arg); + return reply.ToObjects(this.Converter); + } + + public async Task whoami() + { + CandidArg arg = CandidArg.FromCandid(); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "whoami", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + + public async Task withdraw(Token arg0, UnboundedUInt arg1, Principal arg2) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0), CandidTypedValue.FromObject(arg1), CandidTypedValue.FromObject(arg2)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "withdraw", arg); + return reply.ToObjects(this.Converter); + } + } +} + +Type File: 'WithdrawReceipt' + +using EdjCase.ICP.Candid.Mapping; +using Test; +using EdjCase.ICP.Candid.Models; + +namespace Test +{ + [Variant()] + public class WithdrawReceipt + { + [VariantTagProperty()] + public WithdrawReceiptTag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public WithdrawErr? Err { get => this.Tag == WithdrawReceiptTag.Err ? (WithdrawErr)this.Value! : default; set => (this.Tag, this.Value) = (WithdrawReceiptTag.Err, value); } + + public UnboundedUInt? Ok { get => this.Tag == WithdrawReceiptTag.Ok ? (UnboundedUInt)this.Value! : default; set => (this.Tag, this.Value) = (WithdrawReceiptTag.Ok, value); } + + public WithdrawReceipt(WithdrawReceiptTag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected WithdrawReceipt() + { + } + } + + public enum WithdrawReceiptTag + { + Err, + Ok + } +} + +Type File: 'WithdrawErr' + +namespace Test +{ + public enum WithdrawErr + { + BalanceLow, + TransferFailure + } +} + +Type File: 'OrderPlacementReceipt' + +using EdjCase.ICP.Candid.Mapping; +using Test; +using EdjCase.ICP.Candid.Models; + +namespace Test +{ + [Variant()] + public class OrderPlacementReceipt + { + [VariantTagProperty()] + public OrderPlacementReceiptTag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public OrderPlacementErr? Err { get => this.Tag == OrderPlacementReceiptTag.Err ? (OrderPlacementErr)this.Value! : default; set => (this.Tag, this.Value) = (OrderPlacementReceiptTag.Err, value); } + + public OptionalValue? Ok { get => this.Tag == OrderPlacementReceiptTag.Ok ? (OptionalValue)this.Value! : default; set => (this.Tag, this.Value) = (OrderPlacementReceiptTag.Ok, value); } + + public OrderPlacementReceipt(OrderPlacementReceiptTag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected OrderPlacementReceipt() + { + } + } + + public enum OrderPlacementReceiptTag + { + Err, + Ok + } +} + +Type File: 'OrderPlacementErr' + +namespace Test +{ + public enum OrderPlacementErr + { + InvalidOrder, + OrderBookFull + } +} + +Type File: 'Order' + +using EdjCase.ICP.Candid.Models; +using Token = EdjCase.ICP.Candid.Models.Principal; +using OrderId = System.UInt32; + +namespace Test +{ + public class Order + { + public Token from { get; set; } + + public UnboundedUInt fromAmount { get; set; } + + public OrderId id { get; set; } + + public Principal owner { get; set; } + + public Token to { get; set; } + + public UnboundedUInt toAmount { get; set; } + + public Order(Token from, UnboundedUInt fromAmount, OrderId id, Principal owner, Token to, UnboundedUInt toAmount) + { + this.from = from; + this.fromAmount = fromAmount; + this.id = id; + this.owner = owner; + this.to = to; + this.toAmount = toAmount; + } + + public Order() + { + } + } +} + +Type File: 'DepositReceipt' + +using EdjCase.ICP.Candid.Mapping; +using Test; +using EdjCase.ICP.Candid.Models; + +namespace Test +{ + [Variant()] + public class DepositReceipt + { + [VariantTagProperty()] + public DepositReceiptTag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public DepositErr? Err { get => this.Tag == DepositReceiptTag.Err ? (DepositErr)this.Value! : default; set => (this.Tag, this.Value) = (DepositReceiptTag.Err, value); } + + public UnboundedUInt? Ok { get => this.Tag == DepositReceiptTag.Ok ? (UnboundedUInt)this.Value! : default; set => (this.Tag, this.Value) = (DepositReceiptTag.Ok, value); } + + public DepositReceipt(DepositReceiptTag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected DepositReceipt() + { + } + } + + public enum DepositReceiptTag + { + Err, + Ok + } +} + +Type File: 'DepositErr' + +namespace Test +{ + public enum DepositErr + { + BalanceLow, + TransferFailure + } +} + +Type File: 'CancelOrderReceipt' + +using EdjCase.ICP.Candid.Mapping; +using Test; +using OrderId = System.UInt32; + +namespace Test +{ + [Variant()] + public class CancelOrderReceipt + { + [VariantTagProperty()] + public CancelOrderReceiptTag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public CancelOrderErr? Err { get => this.Tag == CancelOrderReceiptTag.Err ? (CancelOrderErr)this.Value! : default; set => (this.Tag, this.Value) = (CancelOrderReceiptTag.Err, value); } + + public OrderId? Ok { get => this.Tag == CancelOrderReceiptTag.Ok ? (OrderId)this.Value! : default; set => (this.Tag, this.Value) = (CancelOrderReceiptTag.Ok, value); } + + public CancelOrderReceipt(CancelOrderReceiptTag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected CancelOrderReceipt() + { + } + } + + public enum CancelOrderReceiptTag + { + Err, + Ok + } +} + +Type File: 'CancelOrderErr' + +namespace Test +{ + public enum CancelOrderErr + { + NotAllowed, + NotExistingOrder + } +} + +Type File: 'Balance' + +using EdjCase.ICP.Candid.Models; +using Token = EdjCase.ICP.Candid.Models.Principal; + +namespace Test +{ + public class Balance + { + public UnboundedUInt amount { get; set; } + + public Principal owner { get; set; } + + public Token token { get; set; } + + public Balance(UnboundedUInt amount, Principal owner, Token token) + { + this.amount = amount; + this.owner = owner; + this.token = token; + } + + public Balance() + { + } + } +} diff --git a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_False_KeepCandidCase_False.snap b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False.snap similarity index 100% rename from test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_False_KeepCandidCase_False.snap rename to test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False.snap diff --git a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True.snap b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True.snap new file mode 100644 index 00000000..6ada7655 --- /dev/null +++ b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True.snap @@ -0,0 +1,59 @@ +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 +{ + public class DuplicatePropertyNamesApiClient + { + public IAgent Agent { get; } + + public Principal CanisterId { get; } + + public CandidConverter Converter { get; } + + public DuplicatePropertyNamesApiClient(IAgent agent, Principal canisterId, CandidConverter converter = default) + { + this.Agent = agent; + this.CanisterId = canisterId; + this.Converter = converter; + } + + public async Task A() + { + CandidArg arg = CandidArg.FromCandid(); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "a", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + } +} + +Type File: 'Result' + +using EdjCase.ICP.Candid.Mapping; + +namespace Test.Models +{ + public class Result + { + [CandidName("a")] + public ulong A { get; set; } + + [CandidName("_a")] + public ulong _A { get; set; } + + public Result(ulong a, ulong _a) + { + this.A = a; + this._A = _a; + } + + public Result() + { + } + } +} diff --git a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_False_KeepCandidCase_True.snap b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False.snap similarity index 100% rename from test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_False_KeepCandidCase_True.snap rename to test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False.snap diff --git a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True.snap b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True.snap new file mode 100644 index 00000000..1312f3a3 --- /dev/null +++ b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True.snap @@ -0,0 +1,55 @@ +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 +{ + public class DuplicatePropertyNamesApiClient + { + public IAgent Agent { get; } + + public Principal CanisterId { get; } + + public CandidConverter Converter { get; } + + public DuplicatePropertyNamesApiClient(IAgent agent, Principal canisterId, CandidConverter converter = default) + { + this.Agent = agent; + this.CanisterId = canisterId; + this.Converter = converter; + } + + public async Task a() + { + CandidArg arg = CandidArg.FromCandid(); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "a", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + } +} + +Type File: 'Result' + +namespace Test.Models +{ + public class Result + { + public ulong a { get; set; } + + public ulong _a { get; set; } + + public Result(ulong a, ulong _a) + { + this.a = a; + this._a = _a; + } + + public Result() + { + } + } +} diff --git a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_True_KeepCandidCase_False.snap b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False.snap similarity index 100% rename from test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_True_KeepCandidCase_False.snap rename to test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False.snap diff --git a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True.snap b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True.snap new file mode 100644 index 00000000..6015c723 --- /dev/null +++ b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True.snap @@ -0,0 +1,59 @@ +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 +{ + public class DuplicatePropertyNamesApiClient + { + public IAgent Agent { get; } + + public Principal CanisterId { get; } + + public CandidConverter? Converter { get; } + + public DuplicatePropertyNamesApiClient(IAgent agent, Principal canisterId, CandidConverter? converter = default) + { + this.Agent = agent; + this.CanisterId = canisterId; + this.Converter = converter; + } + + public async Task A() + { + CandidArg arg = CandidArg.FromCandid(); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "a", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + } +} + +Type File: 'Result' + +using EdjCase.ICP.Candid.Mapping; + +namespace Test.Models +{ + public class Result + { + [CandidName("a")] + public ulong A { get; set; } + + [CandidName("_a")] + public ulong _A { get; set; } + + public Result(ulong a, ulong _a) + { + this.A = a; + this._A = _a; + } + + public Result() + { + } + } +} diff --git a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_True_KeepCandidCase_True.snap b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False.snap similarity index 100% rename from test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_True_KeepCandidCase_True.snap rename to test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False.snap diff --git a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True.snap b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True.snap new file mode 100644 index 00000000..0b6a4542 --- /dev/null +++ b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True.snap @@ -0,0 +1,55 @@ +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 +{ + public class DuplicatePropertyNamesApiClient + { + public IAgent Agent { get; } + + public Principal CanisterId { get; } + + public CandidConverter? Converter { get; } + + public DuplicatePropertyNamesApiClient(IAgent agent, Principal canisterId, CandidConverter? converter = default) + { + this.Agent = agent; + this.CanisterId = canisterId; + this.Converter = converter; + } + + public async Task a() + { + CandidArg arg = CandidArg.FromCandid(); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "a", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + } +} + +Type File: 'Result' + +namespace Test.Models +{ + public class Result + { + public ulong a { get; set; } + + public ulong _a { get; set; } + + public Result(ulong a, ulong _a) + { + this.a = a; + this._a = _a; + } + + public Result() + { + } + } +} diff --git a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_False_KeepCandidCase_False.snap b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False.snap similarity index 100% rename from test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_False_KeepCandidCase_False.snap rename to test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False.snap diff --git a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True.snap b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True.snap new file mode 100644 index 00000000..8feb8a4e --- /dev/null +++ b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True.snap @@ -0,0 +1,59 @@ +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 +{ + public class DuplicatePropertyNamesApiClient + { + public IAgent Agent { get; } + + public Principal CanisterId { get; } + + public CandidConverter Converter { get; } + + public DuplicatePropertyNamesApiClient(IAgent agent, Principal canisterId, CandidConverter converter = default) + { + this.Agent = agent; + this.CanisterId = canisterId; + this.Converter = converter; + } + + public async Task A() + { + CandidArg arg = CandidArg.FromCandid(); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "a", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + } +} + +Type File: 'Result' + +using EdjCase.ICP.Candid.Mapping; + +namespace Test +{ + public class Result + { + [CandidName("a")] + public ulong A { get; set; } + + [CandidName("_a")] + public ulong _A { get; set; } + + public Result(ulong a, ulong _a) + { + this.A = a; + this._A = _a; + } + + public Result() + { + } + } +} diff --git a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_False_KeepCandidCase_True.snap b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False.snap similarity index 100% rename from test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_False_KeepCandidCase_True.snap rename to test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False.snap diff --git a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True.snap b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True.snap new file mode 100644 index 00000000..4492d533 --- /dev/null +++ b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True.snap @@ -0,0 +1,55 @@ +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 +{ + public class DuplicatePropertyNamesApiClient + { + public IAgent Agent { get; } + + public Principal CanisterId { get; } + + public CandidConverter Converter { get; } + + public DuplicatePropertyNamesApiClient(IAgent agent, Principal canisterId, CandidConverter converter = default) + { + this.Agent = agent; + this.CanisterId = canisterId; + this.Converter = converter; + } + + public async Task a() + { + CandidArg arg = CandidArg.FromCandid(); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "a", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + } +} + +Type File: 'Result' + +namespace Test +{ + public class Result + { + public ulong a { get; set; } + + public ulong _a { get; set; } + + public Result(ulong a, ulong _a) + { + this.a = a; + this._a = _a; + } + + public Result() + { + } + } +} diff --git a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_True_KeepCandidCase_False.snap b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False.snap similarity index 100% rename from test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_True_KeepCandidCase_False.snap rename to test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False.snap diff --git a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True.snap b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True.snap new file mode 100644 index 00000000..6f5995fd --- /dev/null +++ b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True.snap @@ -0,0 +1,59 @@ +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 +{ + public class DuplicatePropertyNamesApiClient + { + public IAgent Agent { get; } + + public Principal CanisterId { get; } + + public CandidConverter? Converter { get; } + + public DuplicatePropertyNamesApiClient(IAgent agent, Principal canisterId, CandidConverter? converter = default) + { + this.Agent = agent; + this.CanisterId = canisterId; + this.Converter = converter; + } + + public async Task A() + { + CandidArg arg = CandidArg.FromCandid(); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "a", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + } +} + +Type File: 'Result' + +using EdjCase.ICP.Candid.Mapping; + +namespace Test +{ + public class Result + { + [CandidName("a")] + public ulong A { get; set; } + + [CandidName("_a")] + public ulong _A { get; set; } + + public Result(ulong a, ulong _a) + { + this.A = a; + this._A = _a; + } + + public Result() + { + } + } +} diff --git a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_True_KeepCandidCase_True.snap b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False.snap similarity index 100% rename from test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_True_KeepCandidCase_True.snap rename to test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False.snap diff --git a/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True.snap b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True.snap new file mode 100644 index 00000000..be72442a --- /dev/null +++ b/test/Candid.Tests/Generators/__snapshots__/DuplicatePropertyNames_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True.snap @@ -0,0 +1,55 @@ +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 +{ + public class DuplicatePropertyNamesApiClient + { + public IAgent Agent { get; } + + public Principal CanisterId { get; } + + public CandidConverter? Converter { get; } + + public DuplicatePropertyNamesApiClient(IAgent agent, Principal canisterId, CandidConverter? converter = default) + { + this.Agent = agent; + this.CanisterId = canisterId; + this.Converter = converter; + } + + public async Task a() + { + CandidArg arg = CandidArg.FromCandid(); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "a", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + } +} + +Type File: 'Result' + +namespace Test +{ + public class Result + { + public ulong a { get; set; } + + public ulong _a { get; set; } + + public Result(ulong a, ulong _a) + { + this.a = a; + this._a = _a; + } + + public Result() + { + } + } +} diff --git a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_False_KeepCandidCase_False.snap b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False.snap similarity index 95% rename from test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_False_KeepCandidCase_False.snap rename to test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False.snap index f81374fc..c94d34b5 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_False_KeepCandidCase_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False.snap @@ -210,7 +210,7 @@ using System; namespace Test.Models { - [Variant(typeof(ActionTag))] + [Variant()] public class Action { [VariantTagProperty()] @@ -350,25 +350,15 @@ namespace Test.Models public enum ActionTag { - [VariantOptionType(typeof(KnownNeuron))] RegisterKnownNeuron, - [VariantOptionType(typeof(ManageNeuron))] ManageNeuron, - [VariantOptionType(typeof(ExecuteNnsFunction))] ExecuteNnsFunction, - [VariantOptionType(typeof(RewardNodeProvider))] RewardNodeProvider, - [VariantOptionType(typeof(SetDefaultFollowees))] SetDefaultFollowees, - [VariantOptionType(typeof(RewardNodeProviders))] RewardNodeProviders, - [VariantOptionType(typeof(NetworkEconomics))] ManageNetworkEconomics, - [VariantOptionType(typeof(ApproveGenesisKyc))] ApproveGenesisKyc, - [VariantOptionType(typeof(AddOrRemoveNodeProvider))] AddOrRemoveNodeProvider, - [VariantOptionType(typeof(Motion))] Motion } } @@ -528,7 +518,7 @@ using System; namespace Test.Models { - [Variant(typeof(ByTag))] + [Variant()] public class By { [VariantTagProperty()] @@ -598,11 +588,8 @@ namespace Test.Models public enum ByTag { - [VariantOptionType(typeof(By.NeuronIdOrSubaccountInfo))] NeuronIdOrSubaccount, - [VariantOptionType(typeof(ClaimOrRefreshNeuronFromAccount))] MemoAndController, - [VariantOptionType(typeof(ulong))] Memo } } @@ -615,7 +602,7 @@ using System; namespace Test.Models { - [Variant(typeof(ChangeTag))] + [Variant()] public class Change { [VariantTagProperty()] @@ -667,9 +654,7 @@ namespace Test.Models public enum ChangeTag { - [VariantOptionType(typeof(NodeProvider))] ToRemove, - [VariantOptionType(typeof(NodeProvider))] ToAdd } } @@ -781,7 +766,7 @@ using System; namespace Test.Models { - [Variant(typeof(CommandTag))] + [Variant()] public class Command { [VariantTagProperty()] @@ -932,27 +917,16 @@ namespace Test.Models public enum CommandTag { - [VariantOptionType(typeof(Spawn))] Spawn, - [VariantOptionType(typeof(Split))] Split, - [VariantOptionType(typeof(Follow))] Follow, - [VariantOptionType(typeof(ClaimOrRefresh))] ClaimOrRefresh, - [VariantOptionType(typeof(Configure))] Configure, - [VariantOptionType(typeof(RegisterVote))] RegisterVote, - [VariantOptionType(typeof(Merge))] Merge, - [VariantOptionType(typeof(DisburseToNeuron))] DisburseToNeuron, - [VariantOptionType(typeof(Proposal))] MakeProposal, - [VariantOptionType(typeof(MergeMaturity))] MergeMaturity, - [VariantOptionType(typeof(Disburse))] Disburse } } @@ -965,7 +939,7 @@ using System; namespace Test.Models { - [Variant(typeof(Command1Tag))] + [Variant()] public class Command1 { [VariantTagProperty()] @@ -1155,29 +1129,17 @@ namespace Test.Models public enum Command1Tag { - [VariantOptionType(typeof(GovernanceError))] Error, - [VariantOptionType(typeof(SpawnResponse))] Spawn, - [VariantOptionType(typeof(SpawnResponse))] Split, - [VariantOptionType(typeof(Command1.FollowInfo))] Follow, - [VariantOptionType(typeof(ClaimOrRefreshResponse))] ClaimOrRefresh, - [VariantOptionType(typeof(Command1.ConfigureInfo))] Configure, - [VariantOptionType(typeof(Command1.RegisterVoteInfo))] RegisterVote, - [VariantOptionType(typeof(Command1.MergeInfo))] Merge, - [VariantOptionType(typeof(SpawnResponse))] DisburseToNeuron, - [VariantOptionType(typeof(MakeProposalResponse))] MakeProposal, - [VariantOptionType(typeof(MergeMaturityResponse))] MergeMaturity, - [VariantOptionType(typeof(DisburseResponse))] Disburse } } @@ -1190,7 +1152,7 @@ using System; namespace Test.Models { - [Variant(typeof(Command2Tag))] + [Variant()] public class Command2 { [VariantTagProperty()] @@ -1308,21 +1270,13 @@ namespace Test.Models public enum Command2Tag { - [VariantOptionType(typeof(Spawn))] Spawn, - [VariantOptionType(typeof(Split))] Split, - [VariantOptionType(typeof(Configure))] Configure, - [VariantOptionType(typeof(Merge))] Merge, - [VariantOptionType(typeof(DisburseToNeuron))] DisburseToNeuron, - [VariantOptionType(typeof(ClaimOrRefresh))] ClaimOrRefreshNeuron, - [VariantOptionType(typeof(MergeMaturity))] MergeMaturity, - [VariantOptionType(typeof(Disburse))] Disburse } } @@ -1448,7 +1402,7 @@ using System; namespace Test.Models { - [Variant(typeof(DissolveStateTag))] + [Variant()] public class DissolveState { [VariantTagProperty()] @@ -1500,9 +1454,7 @@ namespace Test.Models public enum DissolveStateTag { - [VariantOptionType(typeof(ulong))] DissolveDelaySeconds, - [VariantOptionType(typeof(ulong))] WhenDissolvedTimestampSeconds } } @@ -2353,7 +2305,7 @@ using System; namespace Test.Models { - [Variant(typeof(NeuronIdOrSubaccountTag))] + [Variant()] public class NeuronIdOrSubaccount { [VariantTagProperty()] @@ -2405,9 +2357,7 @@ namespace Test.Models public enum NeuronIdOrSubaccountTag { - [VariantOptionType(typeof(List))] Subaccount, - [VariantOptionType(typeof(NeuronId))] NeuronId } } @@ -2585,7 +2535,7 @@ using System; namespace Test.Models { - [Variant(typeof(OperationTag))] + [Variant()] public class Operation { [VariantTagProperty()] @@ -2713,19 +2663,12 @@ namespace Test.Models public enum OperationTag { - [VariantOptionType(typeof(RemoveHotKey))] RemoveHotKey, - [VariantOptionType(typeof(AddHotKey))] AddHotKey, - [VariantOptionType(typeof(Operation.StopDissolvingInfo))] StopDissolving, - [VariantOptionType(typeof(Operation.StartDissolvingInfo))] StartDissolving, - [VariantOptionType(typeof(IncreaseDissolveDelay))] IncreaseDissolveDelay, - [VariantOptionType(typeof(Operation.JoinCommunityFundInfo))] JoinCommunityFund, - [VariantOptionType(typeof(SetDissolveTimestamp))] SetDissolveTimestamp } } @@ -2983,7 +2926,7 @@ using System; namespace Test.Models { - [Variant(typeof(ResultTag))] + [Variant()] public class Result { [VariantTagProperty()] @@ -3030,7 +2973,6 @@ namespace Test.Models public enum ResultTag { Ok, - [VariantOptionType(typeof(GovernanceError))] Err } } @@ -3043,7 +2985,7 @@ using System; namespace Test.Models { - [Variant(typeof(Result1Tag))] + [Variant()] public class Result1 { [VariantTagProperty()] @@ -3095,9 +3037,7 @@ namespace Test.Models public enum Result1Tag { - [VariantOptionType(typeof(GovernanceError))] Error, - [VariantOptionType(typeof(NeuronId))] NeuronId } } @@ -3110,7 +3050,7 @@ using System; namespace Test.Models { - [Variant(typeof(Result2Tag))] + [Variant()] public class Result2 { [VariantTagProperty()] @@ -3162,9 +3102,7 @@ namespace Test.Models public enum Result2Tag { - [VariantOptionType(typeof(Neuron))] Ok, - [VariantOptionType(typeof(GovernanceError))] Err } } @@ -3177,7 +3115,7 @@ using System; namespace Test.Models { - [Variant(typeof(Result3Tag))] + [Variant()] public class Result3 { [VariantTagProperty()] @@ -3229,9 +3167,7 @@ namespace Test.Models public enum Result3Tag { - [VariantOptionType(typeof(RewardNodeProviders))] Ok, - [VariantOptionType(typeof(GovernanceError))] Err } } @@ -3244,7 +3180,7 @@ using System; namespace Test.Models { - [Variant(typeof(Result4Tag))] + [Variant()] public class Result4 { [VariantTagProperty()] @@ -3296,9 +3232,7 @@ namespace Test.Models public enum Result4Tag { - [VariantOptionType(typeof(NeuronInfo))] Ok, - [VariantOptionType(typeof(GovernanceError))] Err } } @@ -3311,7 +3245,7 @@ using System; namespace Test.Models { - [Variant(typeof(Result5Tag))] + [Variant()] public class Result5 { [VariantTagProperty()] @@ -3363,9 +3297,7 @@ namespace Test.Models public enum Result5Tag { - [VariantOptionType(typeof(NodeProvider))] Ok, - [VariantOptionType(typeof(GovernanceError))] Err } } @@ -3414,7 +3346,7 @@ using System; namespace Test.Models { - [Variant(typeof(RewardModeTag))] + [Variant()] public class RewardMode { [VariantTagProperty()] @@ -3466,9 +3398,7 @@ namespace Test.Models public enum RewardModeTag { - [VariantOptionType(typeof(RewardToNeuron))] RewardToNeuron, - [VariantOptionType(typeof(RewardToAccount))] RewardToAccount } } diff --git a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True.snap b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True.snap new file mode 100644 index 00000000..81b5c48d --- /dev/null +++ b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True.snap @@ -0,0 +1,2935 @@ +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 +{ + public class GovernanceApiClient + { + public IAgent Agent { get; } + + public Principal CanisterId { get; } + + public CandidConverter Converter { get; } + + public GovernanceApiClient(IAgent agent, Principal canisterId, CandidConverter converter = default) + { + this.Agent = agent; + this.CanisterId = canisterId; + this.Converter = converter; + } + + public async Task ClaimGtcNeurons(Principal arg0, List arg1) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0), CandidTypedValue.FromObject(arg1)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "claim_gtc_neurons", arg); + return reply.ToObjects(this.Converter); + } + + public async Task ClaimOrRefreshNeuronFromAccount(Models.ClaimOrRefreshNeuronFromAccount arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "claim_or_refresh_neuron_from_account", arg); + return reply.ToObjects(this.Converter); + } + + public async Task GetBuildMetadata() + { + CandidArg arg = CandidArg.FromCandid(); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_build_metadata", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + + public async Task GetFullNeuron(ulong arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + + public async Task GetFullNeuronByIdOrSubaccount(Models.NeuronIdOrSubaccount arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron_by_id_or_subaccount", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + + public async Task GetMonthlyNodeProviderRewards() + { + CandidArg arg = CandidArg.FromCandid(); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "get_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(); + 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(); + return reply.ToObjects>(this.Converter); + } + + public async Task GetNeuronInfo(ulong arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + + public async Task GetNeuronInfoByIdOrSubaccount(Models.NeuronIdOrSubaccount arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info_by_id_or_subaccount", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + + public async Task GetNodeProviderByCaller(NullValue arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_node_provider_by_caller", arg); + CandidArg reply = response.ThrowOrGetReply(); + 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(); + return reply.ToObjects>(this.Converter); + } + + public async Task> GetProposalInfo(ulong arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_proposal_info", arg); + CandidArg reply = response.ThrowOrGetReply(); + 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(); + return reply.ToObjects(this.Converter); + } + + public async Task ListNeurons(Models.ListNeurons arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_neurons", arg); + CandidArg reply = response.ThrowOrGetReply(); + 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(); + return reply.ToObjects(this.Converter); + } + + public async Task ListProposals(Models.ListProposalInfo arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_proposals", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + + public async Task ManageNeuron(Models.ManageNeuron arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "manage_neuron", arg); + return reply.ToObjects(this.Converter); + } + + public async Task TransferGtcNeuron(Models.NeuronId arg0, Models.NeuronId arg1) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0), CandidTypedValue.FromObject(arg1)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "transfer_gtc_neuron", arg); + return reply.ToObjects(this.Converter); + } + + public async Task UpdateNodeProvider(Models.UpdateNodeProvider arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "update_node_provider", arg); + return reply.ToObjects(this.Converter); + } + } +} + +Type File: 'AccountIdentifier' + +using EdjCase.ICP.Candid.Mapping; +using System.Collections.Generic; + +namespace Test.Models +{ + public class AccountIdentifier + { + [CandidName("hash")] + public List Hash { get; set; } + + public AccountIdentifier(List hash) + { + this.Hash = hash; + } + + public AccountIdentifier() + { + } + } +} + +Type File: 'Action' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; + +namespace Test.Models +{ + [Variant()] + public class Action + { + [VariantTagProperty()] + public ActionTag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public KnownNeuron RegisterKnownNeuron { get => this.Tag == ActionTag.RegisterKnownNeuron ? (KnownNeuron)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.RegisterKnownNeuron, value); } + + public ManageNeuron ManageNeuron { get => this.Tag == ActionTag.ManageNeuron ? (ManageNeuron)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.ManageNeuron, value); } + + public ExecuteNnsFunction ExecuteNnsFunction { get => this.Tag == ActionTag.ExecuteNnsFunction ? (ExecuteNnsFunction)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.ExecuteNnsFunction, value); } + + public RewardNodeProvider RewardNodeProvider { get => this.Tag == ActionTag.RewardNodeProvider ? (RewardNodeProvider)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.RewardNodeProvider, value); } + + public SetDefaultFollowees SetDefaultFollowees { get => this.Tag == ActionTag.SetDefaultFollowees ? (SetDefaultFollowees)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.SetDefaultFollowees, value); } + + public RewardNodeProviders RewardNodeProviders { get => this.Tag == ActionTag.RewardNodeProviders ? (RewardNodeProviders)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.RewardNodeProviders, value); } + + public NetworkEconomics ManageNetworkEconomics { get => this.Tag == ActionTag.ManageNetworkEconomics ? (NetworkEconomics)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.ManageNetworkEconomics, value); } + + public ApproveGenesisKyc ApproveGenesisKyc { get => this.Tag == ActionTag.ApproveGenesisKyc ? (ApproveGenesisKyc)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.ApproveGenesisKyc, value); } + + public AddOrRemoveNodeProvider AddOrRemoveNodeProvider { get => this.Tag == ActionTag.AddOrRemoveNodeProvider ? (AddOrRemoveNodeProvider)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.AddOrRemoveNodeProvider, value); } + + public Motion Motion { get => this.Tag == ActionTag.Motion ? (Motion)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.Motion, value); } + + public Action(ActionTag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected Action() + { + } + } + + public enum ActionTag + { + RegisterKnownNeuron, + ManageNeuron, + ExecuteNnsFunction, + RewardNodeProvider, + SetDefaultFollowees, + RewardNodeProviders, + ManageNetworkEconomics, + ApproveGenesisKyc, + AddOrRemoveNodeProvider, + Motion + } +} + +Type File: 'AddHotKey' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; + +namespace Test.Models +{ + public class AddHotKey + { + [CandidName("new_hot_key")] + public OptionalValue NewHotKey { get; set; } + + public AddHotKey(OptionalValue newHotKey) + { + this.NewHotKey = newHotKey; + } + + public AddHotKey() + { + } + } +} + +Type File: 'AddOrRemoveNodeProvider' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class AddOrRemoveNodeProvider + { + [CandidName("change")] + public OptionalValue Change { get; set; } + + public AddOrRemoveNodeProvider(OptionalValue change) + { + this.Change = change; + } + + public AddOrRemoveNodeProvider() + { + } + } +} + +Type File: 'Amount' + +using EdjCase.ICP.Candid.Mapping; + +namespace Test.Models +{ + public class Amount + { + [CandidName("e8s")] + public ulong E8s { get; set; } + + public Amount(ulong e8s) + { + this.E8s = e8s; + } + + public Amount() + { + } + } +} + +Type File: 'ApproveGenesisKyc' + +using EdjCase.ICP.Candid.Mapping; +using System.Collections.Generic; +using EdjCase.ICP.Candid.Models; + +namespace Test.Models +{ + public class ApproveGenesisKyc + { + [CandidName("principals")] + public List Principals { get; set; } + + public ApproveGenesisKyc(List principals) + { + this.Principals = principals; + } + + public ApproveGenesisKyc() + { + } + } +} + +Type File: 'Ballot' + +using EdjCase.ICP.Candid.Mapping; + +namespace Test.Models +{ + public class Ballot + { + [CandidName("vote")] + public int Vote { get; set; } + + [CandidName("voting_power")] + public ulong VotingPower { get; set; } + + public Ballot(int vote, ulong votingPower) + { + this.Vote = vote; + this.VotingPower = votingPower; + } + + public Ballot() + { + } + } +} + +Type File: 'BallotInfo' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class BallotInfo + { + [CandidName("vote")] + public int Vote { get; set; } + + [CandidName("proposal_id")] + public OptionalValue ProposalId { get; set; } + + public BallotInfo(int vote, OptionalValue proposalId) + { + this.Vote = vote; + this.ProposalId = proposalId; + } + + public BallotInfo() + { + } + } +} + +Type File: 'By' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; + +namespace Test.Models +{ + [Variant()] + public class By + { + [VariantTagProperty()] + public ByTag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public By.NeuronIdOrSubaccountInfo NeuronIdOrSubaccount { get => this.Tag == ByTag.NeuronIdOrSubaccount ? (By.NeuronIdOrSubaccountInfo)this.Value! : default; set => (this.Tag, this.Value) = (ByTag.NeuronIdOrSubaccount, value); } + + public ClaimOrRefreshNeuronFromAccount MemoAndController { get => this.Tag == ByTag.MemoAndController ? (ClaimOrRefreshNeuronFromAccount)this.Value! : default; set => (this.Tag, this.Value) = (ByTag.MemoAndController, value); } + + public ulong Memo { get => this.Tag == ByTag.Memo ? (ulong)this.Value! : default; set => (this.Tag, this.Value) = (ByTag.Memo, value); } + + public By(ByTag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected By() + { + } + + public class NeuronIdOrSubaccountInfo + { + public NeuronIdOrSubaccountInfo() + { + } + } + } + + public enum ByTag + { + NeuronIdOrSubaccount, + MemoAndController, + Memo + } +} + +Type File: 'Change' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; + +namespace Test.Models +{ + [Variant()] + public class Change + { + [VariantTagProperty()] + public ChangeTag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public NodeProvider ToRemove { get => this.Tag == ChangeTag.ToRemove ? (NodeProvider)this.Value! : default; set => (this.Tag, this.Value) = (ChangeTag.ToRemove, value); } + + public NodeProvider ToAdd { get => this.Tag == ChangeTag.ToAdd ? (NodeProvider)this.Value! : default; set => (this.Tag, this.Value) = (ChangeTag.ToAdd, value); } + + public Change(ChangeTag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected Change() + { + } + } + + public enum ChangeTag + { + ToRemove, + ToAdd + } +} + +Type File: 'ClaimOrRefresh' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class ClaimOrRefresh + { + [CandidName("by")] + public OptionalValue By { get; set; } + + public ClaimOrRefresh(OptionalValue by) + { + this.By = by; + } + + public ClaimOrRefresh() + { + } + } +} + +Type File: 'ClaimOrRefreshNeuronFromAccount' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; + +namespace Test.Models +{ + public class ClaimOrRefreshNeuronFromAccount + { + [CandidName("controller")] + public OptionalValue Controller { get; set; } + + [CandidName("memo")] + public ulong Memo { get; set; } + + public ClaimOrRefreshNeuronFromAccount(OptionalValue controller, ulong memo) + { + this.Controller = controller; + this.Memo = memo; + } + + public ClaimOrRefreshNeuronFromAccount() + { + } + } +} + +Type File: 'ClaimOrRefreshNeuronFromAccountResponse' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class ClaimOrRefreshNeuronFromAccountResponse + { + [CandidName("result")] + public OptionalValue Result { get; set; } + + public ClaimOrRefreshNeuronFromAccountResponse(OptionalValue result) + { + this.Result = result; + } + + public ClaimOrRefreshNeuronFromAccountResponse() + { + } + } +} + +Type File: 'ClaimOrRefreshResponse' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class ClaimOrRefreshResponse + { + [CandidName("refreshed_neuron_id")] + public OptionalValue RefreshedNeuronId { get; set; } + + public ClaimOrRefreshResponse(OptionalValue refreshedNeuronId) + { + this.RefreshedNeuronId = refreshedNeuronId; + } + + public ClaimOrRefreshResponse() + { + } + } +} + +Type File: 'Command' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; + +namespace Test.Models +{ + [Variant()] + public class Command + { + [VariantTagProperty()] + public CommandTag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public Spawn Spawn { get => this.Tag == CommandTag.Spawn ? (Spawn)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.Spawn, value); } + + public Split Split { get => this.Tag == CommandTag.Split ? (Split)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.Split, value); } + + public Follow Follow { get => this.Tag == CommandTag.Follow ? (Follow)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.Follow, value); } + + public ClaimOrRefresh ClaimOrRefresh { get => this.Tag == CommandTag.ClaimOrRefresh ? (ClaimOrRefresh)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.ClaimOrRefresh, value); } + + public Configure Configure { get => this.Tag == CommandTag.Configure ? (Configure)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.Configure, value); } + + public RegisterVote RegisterVote { get => this.Tag == CommandTag.RegisterVote ? (RegisterVote)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.RegisterVote, value); } + + public Merge Merge { get => this.Tag == CommandTag.Merge ? (Merge)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.Merge, value); } + + public DisburseToNeuron DisburseToNeuron { get => this.Tag == CommandTag.DisburseToNeuron ? (DisburseToNeuron)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.DisburseToNeuron, value); } + + public Proposal MakeProposal { get => this.Tag == CommandTag.MakeProposal ? (Proposal)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.MakeProposal, value); } + + public MergeMaturity MergeMaturity { get => this.Tag == CommandTag.MergeMaturity ? (MergeMaturity)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.MergeMaturity, value); } + + public Disburse Disburse { get => this.Tag == CommandTag.Disburse ? (Disburse)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.Disburse, value); } + + public Command(CommandTag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected Command() + { + } + } + + public enum CommandTag + { + Spawn, + Split, + Follow, + ClaimOrRefresh, + Configure, + RegisterVote, + Merge, + DisburseToNeuron, + MakeProposal, + MergeMaturity, + Disburse + } +} + +Type File: 'Command1' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; + +namespace Test.Models +{ + [Variant()] + public class Command1 + { + [VariantTagProperty()] + public Command1Tag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public GovernanceError Error { get => this.Tag == Command1Tag.Error ? (GovernanceError)this.Value! : default; set => (this.Tag, this.Value) = (Command1Tag.Error, value); } + + public SpawnResponse Spawn { get => this.Tag == Command1Tag.Spawn ? (SpawnResponse)this.Value! : default; set => (this.Tag, this.Value) = (Command1Tag.Spawn, value); } + + public SpawnResponse Split { get => this.Tag == Command1Tag.Split ? (SpawnResponse)this.Value! : default; set => (this.Tag, this.Value) = (Command1Tag.Split, value); } + + public Command1.FollowInfo Follow { get => this.Tag == Command1Tag.Follow ? (Command1.FollowInfo)this.Value! : default; set => (this.Tag, this.Value) = (Command1Tag.Follow, value); } + + public ClaimOrRefreshResponse ClaimOrRefresh { get => this.Tag == Command1Tag.ClaimOrRefresh ? (ClaimOrRefreshResponse)this.Value! : default; set => (this.Tag, this.Value) = (Command1Tag.ClaimOrRefresh, value); } + + public Command1.ConfigureInfo Configure { get => this.Tag == Command1Tag.Configure ? (Command1.ConfigureInfo)this.Value! : default; set => (this.Tag, this.Value) = (Command1Tag.Configure, value); } + + public Command1.RegisterVoteInfo RegisterVote { get => this.Tag == Command1Tag.RegisterVote ? (Command1.RegisterVoteInfo)this.Value! : default; set => (this.Tag, this.Value) = (Command1Tag.RegisterVote, value); } + + public Command1.MergeInfo Merge { get => this.Tag == Command1Tag.Merge ? (Command1.MergeInfo)this.Value! : default; set => (this.Tag, this.Value) = (Command1Tag.Merge, value); } + + public SpawnResponse DisburseToNeuron { get => this.Tag == Command1Tag.DisburseToNeuron ? (SpawnResponse)this.Value! : default; set => (this.Tag, this.Value) = (Command1Tag.DisburseToNeuron, value); } + + public MakeProposalResponse MakeProposal { get => this.Tag == Command1Tag.MakeProposal ? (MakeProposalResponse)this.Value! : default; set => (this.Tag, this.Value) = (Command1Tag.MakeProposal, value); } + + public MergeMaturityResponse MergeMaturity { get => this.Tag == Command1Tag.MergeMaturity ? (MergeMaturityResponse)this.Value! : default; set => (this.Tag, this.Value) = (Command1Tag.MergeMaturity, value); } + + public DisburseResponse Disburse { get => this.Tag == Command1Tag.Disburse ? (DisburseResponse)this.Value! : default; set => (this.Tag, this.Value) = (Command1Tag.Disburse, value); } + + public Command1(Command1Tag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected Command1() + { + } + + public class FollowInfo + { + public FollowInfo() + { + } + } + + public class ConfigureInfo + { + public ConfigureInfo() + { + } + } + + public class RegisterVoteInfo + { + public RegisterVoteInfo() + { + } + } + + public class MergeInfo + { + public MergeInfo() + { + } + } + } + + public enum Command1Tag + { + Error, + Spawn, + Split, + Follow, + ClaimOrRefresh, + Configure, + RegisterVote, + Merge, + DisburseToNeuron, + MakeProposal, + MergeMaturity, + Disburse + } +} + +Type File: 'Command2' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; + +namespace Test.Models +{ + [Variant()] + public class Command2 + { + [VariantTagProperty()] + public Command2Tag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public Spawn Spawn { get => this.Tag == Command2Tag.Spawn ? (Spawn)this.Value! : default; set => (this.Tag, this.Value) = (Command2Tag.Spawn, value); } + + public Split Split { get => this.Tag == Command2Tag.Split ? (Split)this.Value! : default; set => (this.Tag, this.Value) = (Command2Tag.Split, value); } + + public Configure Configure { get => this.Tag == Command2Tag.Configure ? (Configure)this.Value! : default; set => (this.Tag, this.Value) = (Command2Tag.Configure, value); } + + public Merge Merge { get => this.Tag == Command2Tag.Merge ? (Merge)this.Value! : default; set => (this.Tag, this.Value) = (Command2Tag.Merge, value); } + + public DisburseToNeuron DisburseToNeuron { get => this.Tag == Command2Tag.DisburseToNeuron ? (DisburseToNeuron)this.Value! : default; set => (this.Tag, this.Value) = (Command2Tag.DisburseToNeuron, value); } + + public ClaimOrRefresh ClaimOrRefreshNeuron { get => this.Tag == Command2Tag.ClaimOrRefreshNeuron ? (ClaimOrRefresh)this.Value! : default; set => (this.Tag, this.Value) = (Command2Tag.ClaimOrRefreshNeuron, value); } + + public MergeMaturity MergeMaturity { get => this.Tag == Command2Tag.MergeMaturity ? (MergeMaturity)this.Value! : default; set => (this.Tag, this.Value) = (Command2Tag.MergeMaturity, value); } + + public Disburse Disburse { get => this.Tag == Command2Tag.Disburse ? (Disburse)this.Value! : default; set => (this.Tag, this.Value) = (Command2Tag.Disburse, value); } + + public Command2(Command2Tag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected Command2() + { + } + } + + public enum Command2Tag + { + Spawn, + Split, + Configure, + Merge, + DisburseToNeuron, + ClaimOrRefreshNeuron, + MergeMaturity, + Disburse + } +} + +Type File: 'Configure' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class Configure + { + [CandidName("operation")] + public OptionalValue Operation { get; set; } + + public Configure(OptionalValue operation) + { + this.Operation = operation; + } + + public Configure() + { + } + } +} + +Type File: 'Disburse' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class Disburse + { + [CandidName("to_account")] + public OptionalValue ToAccount { get; set; } + + [CandidName("amount")] + public OptionalValue Amount { get; set; } + + public Disburse(OptionalValue toAccount, OptionalValue amount) + { + this.ToAccount = toAccount; + this.Amount = amount; + } + + public Disburse() + { + } + } +} + +Type File: 'DisburseResponse' + +using EdjCase.ICP.Candid.Mapping; + +namespace Test.Models +{ + public class DisburseResponse + { + [CandidName("transfer_block_height")] + public ulong TransferBlockHeight { get; set; } + + public DisburseResponse(ulong transferBlockHeight) + { + this.TransferBlockHeight = transferBlockHeight; + } + + public DisburseResponse() + { + } + } +} + +Type File: 'DisburseToNeuron' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; + +namespace Test.Models +{ + public class DisburseToNeuron + { + [CandidName("dissolve_delay_seconds")] + public ulong DissolveDelaySeconds { get; set; } + + [CandidName("kyc_verified")] + public bool KycVerified { get; set; } + + [CandidName("amount_e8s")] + public ulong AmountE8s { get; set; } + + [CandidName("new_controller")] + public OptionalValue NewController { get; set; } + + [CandidName("nonce")] + public ulong Nonce { get; set; } + + public DisburseToNeuron(ulong dissolveDelaySeconds, bool kycVerified, ulong amountE8s, OptionalValue newController, ulong nonce) + { + this.DissolveDelaySeconds = dissolveDelaySeconds; + this.KycVerified = kycVerified; + this.AmountE8s = amountE8s; + this.NewController = newController; + this.Nonce = nonce; + } + + public DisburseToNeuron() + { + } + } +} + +Type File: 'DissolveState' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; + +namespace Test.Models +{ + [Variant()] + public class DissolveState + { + [VariantTagProperty()] + public DissolveStateTag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public ulong DissolveDelaySeconds { get => this.Tag == DissolveStateTag.DissolveDelaySeconds ? (ulong)this.Value! : default; set => (this.Tag, this.Value) = (DissolveStateTag.DissolveDelaySeconds, value); } + + public ulong WhenDissolvedTimestampSeconds { get => this.Tag == DissolveStateTag.WhenDissolvedTimestampSeconds ? (ulong)this.Value! : default; set => (this.Tag, this.Value) = (DissolveStateTag.WhenDissolvedTimestampSeconds, value); } + + public DissolveState(DissolveStateTag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected DissolveState() + { + } + } + + public enum DissolveStateTag + { + DissolveDelaySeconds, + WhenDissolvedTimestampSeconds + } +} + +Type File: 'ExecuteNnsFunction' + +using EdjCase.ICP.Candid.Mapping; +using System.Collections.Generic; + +namespace Test.Models +{ + public class ExecuteNnsFunction + { + [CandidName("nns_function")] + public int NnsFunction { get; set; } + + [CandidName("payload")] + public List Payload { get; set; } + + public ExecuteNnsFunction(int nnsFunction, List payload) + { + this.NnsFunction = nnsFunction; + this.Payload = payload; + } + + public ExecuteNnsFunction() + { + } + } +} + +Type File: 'Follow' + +using EdjCase.ICP.Candid.Mapping; +using System.Collections.Generic; +using Test.Models; + +namespace Test.Models +{ + public class Follow + { + [CandidName("topic")] + public int Topic { get; set; } + + [CandidName("followees")] + public List Followees { get; set; } + + public Follow(int topic, List followees) + { + this.Topic = topic; + this.Followees = followees; + } + + public Follow() + { + } + } +} + +Type File: 'Followees' + +using EdjCase.ICP.Candid.Mapping; +using System.Collections.Generic; +using Test.Models; + +namespace Test.Models +{ + public class Followees + { + [CandidName("followees")] + public List Followees_ { get; set; } + + public Followees(List followees) + { + this.Followees_ = followees; + } + + public Followees() + { + } + } +} + +Type File: 'Governance' + +using EdjCase.ICP.Candid.Mapping; +using System.Collections.Generic; +using Test.Models; +using EdjCase.ICP.Candid.Models; + +namespace Test.Models +{ + public class Governance + { + [CandidName("default_followees")] + public Dictionary DefaultFollowees { get; set; } + + [CandidName("wait_for_quiet_threshold_seconds")] + public ulong WaitForQuietThresholdSeconds { get; set; } + + [CandidName("metrics")] + public OptionalValue Metrics { get; set; } + + [CandidName("node_providers")] + public List NodeProviders { get; set; } + + [CandidName("economics")] + public OptionalValue Economics { get; set; } + + [CandidName("latest_reward_event")] + public OptionalValue LatestRewardEvent { get; set; } + + [CandidName("to_claim_transfers")] + public List ToClaimTransfers { get; set; } + + [CandidName("short_voting_period_seconds")] + public ulong ShortVotingPeriodSeconds { get; set; } + + [CandidName("proposals")] + public Dictionary Proposals { get; set; } + + [CandidName("in_flight_commands")] + public Dictionary InFlightCommands { get; set; } + + [CandidName("neurons")] + public Dictionary Neurons { get; set; } + + [CandidName("genesis_timestamp_seconds")] + public ulong GenesisTimestampSeconds { get; set; } + + public Governance(Dictionary defaultFollowees, ulong waitForQuietThresholdSeconds, OptionalValue metrics, List nodeProviders, OptionalValue economics, OptionalValue latestRewardEvent, List toClaimTransfers, ulong shortVotingPeriodSeconds, Dictionary proposals, Dictionary inFlightCommands, Dictionary neurons, ulong genesisTimestampSeconds) + { + this.DefaultFollowees = defaultFollowees; + this.WaitForQuietThresholdSeconds = waitForQuietThresholdSeconds; + this.Metrics = metrics; + this.NodeProviders = nodeProviders; + this.Economics = economics; + this.LatestRewardEvent = latestRewardEvent; + this.ToClaimTransfers = toClaimTransfers; + this.ShortVotingPeriodSeconds = shortVotingPeriodSeconds; + this.Proposals = proposals; + this.InFlightCommands = inFlightCommands; + this.Neurons = neurons; + this.GenesisTimestampSeconds = genesisTimestampSeconds; + } + + public Governance() + { + } + } +} + +Type File: 'GovernanceCachedMetrics' + +using EdjCase.ICP.Candid.Mapping; +using System.Collections.Generic; + +namespace Test.Models +{ + public class GovernanceCachedMetrics + { + [CandidName("not_dissolving_neurons_e8s_buckets")] + public Dictionary NotDissolvingNeuronsE8sBuckets { get; set; } + + [CandidName("garbage_collectable_neurons_count")] + public ulong GarbageCollectableNeuronsCount { get; set; } + + [CandidName("neurons_with_invalid_stake_count")] + public ulong NeuronsWithInvalidStakeCount { get; set; } + + [CandidName("not_dissolving_neurons_count_buckets")] + public Dictionary NotDissolvingNeuronsCountBuckets { get; set; } + + [CandidName("total_supply_icp")] + public ulong TotalSupplyIcp { get; set; } + + [CandidName("neurons_with_less_than_6_months_dissolve_delay_count")] + public ulong NeuronsWithLessThan6MonthsDissolveDelayCount { get; set; } + + [CandidName("dissolved_neurons_count")] + public ulong DissolvedNeuronsCount { get; set; } + + [CandidName("total_staked_e8s")] + public ulong TotalStakedE8s { get; set; } + + [CandidName("not_dissolving_neurons_count")] + public ulong NotDissolvingNeuronsCount { get; set; } + + [CandidName("dissolved_neurons_e8s")] + public ulong DissolvedNeuronsE8s { get; set; } + + [CandidName("neurons_with_less_than_6_months_dissolve_delay_e8s")] + public ulong NeuronsWithLessThan6MonthsDissolveDelayE8s { get; set; } + + [CandidName("dissolving_neurons_count_buckets")] + public Dictionary DissolvingNeuronsCountBuckets { get; set; } + + [CandidName("dissolving_neurons_count")] + public ulong DissolvingNeuronsCount { get; set; } + + [CandidName("dissolving_neurons_e8s_buckets")] + public Dictionary DissolvingNeuronsE8sBuckets { get; set; } + + [CandidName("community_fund_total_staked_e8s")] + public ulong CommunityFundTotalStakedE8s { get; set; } + + [CandidName("timestamp_seconds")] + public ulong TimestampSeconds { get; set; } + + public GovernanceCachedMetrics(Dictionary notDissolvingNeuronsE8sBuckets, ulong garbageCollectableNeuronsCount, ulong neuronsWithInvalidStakeCount, Dictionary notDissolvingNeuronsCountBuckets, ulong totalSupplyIcp, ulong neuronsWithLessThan6MonthsDissolveDelayCount, ulong dissolvedNeuronsCount, ulong totalStakedE8s, ulong notDissolvingNeuronsCount, ulong dissolvedNeuronsE8s, ulong neuronsWithLessThan6MonthsDissolveDelayE8s, Dictionary dissolvingNeuronsCountBuckets, ulong dissolvingNeuronsCount, Dictionary dissolvingNeuronsE8sBuckets, ulong communityFundTotalStakedE8s, ulong timestampSeconds) + { + this.NotDissolvingNeuronsE8sBuckets = notDissolvingNeuronsE8sBuckets; + this.GarbageCollectableNeuronsCount = garbageCollectableNeuronsCount; + this.NeuronsWithInvalidStakeCount = neuronsWithInvalidStakeCount; + this.NotDissolvingNeuronsCountBuckets = notDissolvingNeuronsCountBuckets; + this.TotalSupplyIcp = totalSupplyIcp; + this.NeuronsWithLessThan6MonthsDissolveDelayCount = neuronsWithLessThan6MonthsDissolveDelayCount; + this.DissolvedNeuronsCount = dissolvedNeuronsCount; + this.TotalStakedE8s = totalStakedE8s; + this.NotDissolvingNeuronsCount = notDissolvingNeuronsCount; + this.DissolvedNeuronsE8s = dissolvedNeuronsE8s; + this.NeuronsWithLessThan6MonthsDissolveDelayE8s = neuronsWithLessThan6MonthsDissolveDelayE8s; + this.DissolvingNeuronsCountBuckets = dissolvingNeuronsCountBuckets; + this.DissolvingNeuronsCount = dissolvingNeuronsCount; + this.DissolvingNeuronsE8sBuckets = dissolvingNeuronsE8sBuckets; + this.CommunityFundTotalStakedE8s = communityFundTotalStakedE8s; + this.TimestampSeconds = timestampSeconds; + } + + public GovernanceCachedMetrics() + { + } + } +} + +Type File: 'GovernanceError' + +using EdjCase.ICP.Candid.Mapping; + +namespace Test.Models +{ + public class GovernanceError + { + [CandidName("error_message")] + public string ErrorMessage { get; set; } + + [CandidName("error_type")] + public int ErrorType { get; set; } + + public GovernanceError(string errorMessage, int errorType) + { + this.ErrorMessage = errorMessage; + this.ErrorType = errorType; + } + + public GovernanceError() + { + } + } +} + +Type File: 'IncreaseDissolveDelay' + +using EdjCase.ICP.Candid.Mapping; + +namespace Test.Models +{ + public class IncreaseDissolveDelay + { + [CandidName("additional_dissolve_delay_seconds")] + public uint AdditionalDissolveDelaySeconds { get; set; } + + public IncreaseDissolveDelay(uint additionalDissolveDelaySeconds) + { + this.AdditionalDissolveDelaySeconds = additionalDissolveDelaySeconds; + } + + public IncreaseDissolveDelay() + { + } + } +} + +Type File: 'KnownNeuron' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class KnownNeuron + { + [CandidName("id")] + public OptionalValue Id { get; set; } + + [CandidName("known_neuron_data")] + public OptionalValue KnownNeuronData { get; set; } + + public KnownNeuron(OptionalValue id, OptionalValue knownNeuronData) + { + this.Id = id; + this.KnownNeuronData = knownNeuronData; + } + + public KnownNeuron() + { + } + } +} + +Type File: 'KnownNeuronData' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; + +namespace Test.Models +{ + public class KnownNeuronData + { + [CandidName("name")] + public string Name { get; set; } + + [CandidName("description")] + public OptionalValue Description { get; set; } + + public KnownNeuronData(string name, OptionalValue description) + { + this.Name = name; + this.Description = description; + } + + public KnownNeuronData() + { + } + } +} + +Type File: 'ListKnownNeuronsResponse' + +using EdjCase.ICP.Candid.Mapping; +using System.Collections.Generic; +using Test.Models; + +namespace Test.Models +{ + public class ListKnownNeuronsResponse + { + [CandidName("known_neurons")] + public List KnownNeurons { get; set; } + + public ListKnownNeuronsResponse(List knownNeurons) + { + this.KnownNeurons = knownNeurons; + } + + public ListKnownNeuronsResponse() + { + } + } +} + +Type File: 'ListNeurons' + +using EdjCase.ICP.Candid.Mapping; +using System.Collections.Generic; + +namespace Test.Models +{ + public class ListNeurons + { + [CandidName("neuron_ids")] + public List NeuronIds { get; set; } + + [CandidName("include_neurons_readable_by_caller")] + public bool IncludeNeuronsReadableByCaller { get; set; } + + public ListNeurons(List neuronIds, bool includeNeuronsReadableByCaller) + { + this.NeuronIds = neuronIds; + this.IncludeNeuronsReadableByCaller = includeNeuronsReadableByCaller; + } + + public ListNeurons() + { + } + } +} + +Type File: 'ListNeuronsResponse' + +using EdjCase.ICP.Candid.Mapping; +using System.Collections.Generic; +using Test.Models; + +namespace Test.Models +{ + public class ListNeuronsResponse + { + [CandidName("neuron_infos")] + public Dictionary NeuronInfos { get; set; } + + [CandidName("full_neurons")] + public List FullNeurons { get; set; } + + public ListNeuronsResponse(Dictionary neuronInfos, List fullNeurons) + { + this.NeuronInfos = neuronInfos; + this.FullNeurons = fullNeurons; + } + + public ListNeuronsResponse() + { + } + } +} + +Type File: 'ListNodeProvidersResponse' + +using EdjCase.ICP.Candid.Mapping; +using System.Collections.Generic; +using Test.Models; + +namespace Test.Models +{ + public class ListNodeProvidersResponse + { + [CandidName("node_providers")] + public List NodeProviders { get; set; } + + public ListNodeProvidersResponse(List nodeProviders) + { + this.NodeProviders = nodeProviders; + } + + public ListNodeProvidersResponse() + { + } + } +} + +Type File: 'ListProposalInfo' + +using EdjCase.ICP.Candid.Mapping; +using System.Collections.Generic; +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class ListProposalInfo + { + [CandidName("include_reward_status")] + public List IncludeRewardStatus { get; set; } + + [CandidName("before_proposal")] + public OptionalValue BeforeProposal { get; set; } + + [CandidName("limit")] + public uint Limit { get; set; } + + [CandidName("exclude_topic")] + public List ExcludeTopic { get; set; } + + [CandidName("include_status")] + public List IncludeStatus { get; set; } + + public ListProposalInfo(List includeRewardStatus, OptionalValue beforeProposal, uint limit, List excludeTopic, List includeStatus) + { + this.IncludeRewardStatus = includeRewardStatus; + this.BeforeProposal = beforeProposal; + this.Limit = limit; + this.ExcludeTopic = excludeTopic; + this.IncludeStatus = includeStatus; + } + + public ListProposalInfo() + { + } + } +} + +Type File: 'ListProposalInfoResponse' + +using EdjCase.ICP.Candid.Mapping; +using System.Collections.Generic; +using Test.Models; + +namespace Test.Models +{ + public class ListProposalInfoResponse + { + [CandidName("proposal_info")] + public List ProposalInfo { get; set; } + + public ListProposalInfoResponse(List proposalInfo) + { + this.ProposalInfo = proposalInfo; + } + + public ListProposalInfoResponse() + { + } + } +} + +Type File: 'MakeProposalResponse' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class MakeProposalResponse + { + [CandidName("proposal_id")] + public OptionalValue ProposalId { get; set; } + + public MakeProposalResponse(OptionalValue proposalId) + { + this.ProposalId = proposalId; + } + + public MakeProposalResponse() + { + } + } +} + +Type File: 'ManageNeuron' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class ManageNeuron + { + [CandidName("id")] + public OptionalValue Id { get; set; } + + [CandidName("command")] + public OptionalValue Command { get; set; } + + [CandidName("neuron_id_or_subaccount")] + public OptionalValue NeuronIdOrSubaccount { get; set; } + + public ManageNeuron(OptionalValue id, OptionalValue command, OptionalValue neuronIdOrSubaccount) + { + this.Id = id; + this.Command = command; + this.NeuronIdOrSubaccount = neuronIdOrSubaccount; + } + + public ManageNeuron() + { + } + } +} + +Type File: 'ManageNeuronResponse' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class ManageNeuronResponse + { + [CandidName("command")] + public OptionalValue Command { get; set; } + + public ManageNeuronResponse(OptionalValue command) + { + this.Command = command; + } + + public ManageNeuronResponse() + { + } + } +} + +Type File: 'Merge' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class Merge + { + [CandidName("source_neuron_id")] + public OptionalValue SourceNeuronId { get; set; } + + public Merge(OptionalValue sourceNeuronId) + { + this.SourceNeuronId = sourceNeuronId; + } + + public Merge() + { + } + } +} + +Type File: 'MergeMaturity' + +using EdjCase.ICP.Candid.Mapping; + +namespace Test.Models +{ + public class MergeMaturity + { + [CandidName("percentage_to_merge")] + public uint PercentageToMerge { get; set; } + + public MergeMaturity(uint percentageToMerge) + { + this.PercentageToMerge = percentageToMerge; + } + + public MergeMaturity() + { + } + } +} + +Type File: 'MergeMaturityResponse' + +using EdjCase.ICP.Candid.Mapping; + +namespace Test.Models +{ + public class MergeMaturityResponse + { + [CandidName("merged_maturity_e8s")] + public ulong MergedMaturityE8s { get; set; } + + [CandidName("new_stake_e8s")] + public ulong NewStakeE8s { get; set; } + + public MergeMaturityResponse(ulong mergedMaturityE8s, ulong newStakeE8s) + { + this.MergedMaturityE8s = mergedMaturityE8s; + this.NewStakeE8s = newStakeE8s; + } + + public MergeMaturityResponse() + { + } + } +} + +Type File: 'Motion' + +using EdjCase.ICP.Candid.Mapping; + +namespace Test.Models +{ + public class Motion + { + [CandidName("motion_text")] + public string MotionText { get; set; } + + public Motion(string motionText) + { + this.MotionText = motionText; + } + + public Motion() + { + } + } +} + +Type File: 'NetworkEconomics' + +using EdjCase.ICP.Candid.Mapping; + +namespace Test.Models +{ + public class NetworkEconomics + { + [CandidName("neuron_minimum_stake_e8s")] + public ulong NeuronMinimumStakeE8s { get; set; } + + [CandidName("max_proposals_to_keep_per_topic")] + public uint MaxProposalsToKeepPerTopic { get; set; } + + [CandidName("neuron_management_fee_per_proposal_e8s")] + public ulong NeuronManagementFeePerProposalE8s { get; set; } + + [CandidName("reject_cost_e8s")] + public ulong RejectCostE8s { get; set; } + + [CandidName("transaction_fee_e8s")] + public ulong TransactionFeeE8s { get; set; } + + [CandidName("neuron_spawn_dissolve_delay_seconds")] + public ulong NeuronSpawnDissolveDelaySeconds { get; set; } + + [CandidName("minimum_icp_xdr_rate")] + public ulong MinimumIcpXdrRate { get; set; } + + [CandidName("maximum_node_provider_rewards_e8s")] + public ulong MaximumNodeProviderRewardsE8s { get; set; } + + public NetworkEconomics(ulong neuronMinimumStakeE8s, uint maxProposalsToKeepPerTopic, ulong neuronManagementFeePerProposalE8s, ulong rejectCostE8s, ulong transactionFeeE8s, ulong neuronSpawnDissolveDelaySeconds, ulong minimumIcpXdrRate, ulong maximumNodeProviderRewardsE8s) + { + this.NeuronMinimumStakeE8s = neuronMinimumStakeE8s; + this.MaxProposalsToKeepPerTopic = maxProposalsToKeepPerTopic; + this.NeuronManagementFeePerProposalE8s = neuronManagementFeePerProposalE8s; + this.RejectCostE8s = rejectCostE8s; + this.TransactionFeeE8s = transactionFeeE8s; + this.NeuronSpawnDissolveDelaySeconds = neuronSpawnDissolveDelaySeconds; + this.MinimumIcpXdrRate = minimumIcpXdrRate; + this.MaximumNodeProviderRewardsE8s = maximumNodeProviderRewardsE8s; + } + + public NetworkEconomics() + { + } + } +} + +Type File: 'Neuron' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test.Models; +using System.Collections.Generic; + +namespace Test.Models +{ + public class Neuron + { + [CandidName("id")] + public OptionalValue Id { get; set; } + + [CandidName("controller")] + public OptionalValue Controller { get; set; } + + [CandidName("recent_ballots")] + public List RecentBallots { get; set; } + + [CandidName("kyc_verified")] + public bool KycVerified { get; set; } + + [CandidName("not_for_profit")] + public bool NotForProfit { get; set; } + + [CandidName("maturity_e8s_equivalent")] + public ulong MaturityE8sEquivalent { get; set; } + + [CandidName("cached_neuron_stake_e8s")] + public ulong CachedNeuronStakeE8s { get; set; } + + [CandidName("created_timestamp_seconds")] + public ulong CreatedTimestampSeconds { get; set; } + + [CandidName("aging_since_timestamp_seconds")] + public ulong AgingSinceTimestampSeconds { get; set; } + + [CandidName("hot_keys")] + public List HotKeys { get; set; } + + [CandidName("account")] + public List Account { get; set; } + + [CandidName("joined_community_fund_timestamp_seconds")] + public OptionalValue JoinedCommunityFundTimestampSeconds { get; set; } + + [CandidName("dissolve_state")] + public OptionalValue DissolveState { get; set; } + + [CandidName("followees")] + public Dictionary Followees { get; set; } + + [CandidName("neuron_fees_e8s")] + public ulong NeuronFeesE8s { get; set; } + + [CandidName("transfer")] + public OptionalValue Transfer { get; set; } + + [CandidName("known_neuron_data")] + public OptionalValue KnownNeuronData { get; set; } + + public Neuron(OptionalValue id, OptionalValue controller, List recentBallots, bool kycVerified, bool notForProfit, ulong maturityE8sEquivalent, ulong cachedNeuronStakeE8s, ulong createdTimestampSeconds, ulong agingSinceTimestampSeconds, List hotKeys, List account, OptionalValue joinedCommunityFundTimestampSeconds, OptionalValue dissolveState, Dictionary followees, ulong neuronFeesE8s, OptionalValue transfer, OptionalValue knownNeuronData) + { + this.Id = id; + this.Controller = controller; + this.RecentBallots = recentBallots; + this.KycVerified = kycVerified; + this.NotForProfit = notForProfit; + this.MaturityE8sEquivalent = maturityE8sEquivalent; + this.CachedNeuronStakeE8s = cachedNeuronStakeE8s; + this.CreatedTimestampSeconds = createdTimestampSeconds; + this.AgingSinceTimestampSeconds = agingSinceTimestampSeconds; + this.HotKeys = hotKeys; + this.Account = account; + this.JoinedCommunityFundTimestampSeconds = joinedCommunityFundTimestampSeconds; + this.DissolveState = dissolveState; + this.Followees = followees; + this.NeuronFeesE8s = neuronFeesE8s; + this.Transfer = transfer; + this.KnownNeuronData = knownNeuronData; + } + + public Neuron() + { + } + } +} + +Type File: 'NeuronId' + +using EdjCase.ICP.Candid.Mapping; + +namespace Test.Models +{ + public class NeuronId + { + [CandidName("id")] + public ulong Id { get; set; } + + public NeuronId(ulong id) + { + this.Id = id; + } + + public NeuronId() + { + } + } +} + +Type File: 'NeuronIdOrSubaccount' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; +using System.Collections.Generic; + +namespace Test.Models +{ + [Variant()] + public class NeuronIdOrSubaccount + { + [VariantTagProperty()] + public NeuronIdOrSubaccountTag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public List Subaccount { get => this.Tag == NeuronIdOrSubaccountTag.Subaccount ? (List)this.Value! : default; set => (this.Tag, this.Value) = (NeuronIdOrSubaccountTag.Subaccount, value); } + + public NeuronId NeuronId { get => this.Tag == NeuronIdOrSubaccountTag.NeuronId ? (NeuronId)this.Value! : default; set => (this.Tag, this.Value) = (NeuronIdOrSubaccountTag.NeuronId, value); } + + public NeuronIdOrSubaccount(NeuronIdOrSubaccountTag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected NeuronIdOrSubaccount() + { + } + } + + public enum NeuronIdOrSubaccountTag + { + Subaccount, + NeuronId + } +} + +Type File: 'NeuronInFlightCommand' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class NeuronInFlightCommand + { + [CandidName("command")] + public OptionalValue Command { get; set; } + + [CandidName("timestamp")] + public ulong Timestamp { get; set; } + + public NeuronInFlightCommand(OptionalValue command, ulong timestamp) + { + this.Command = command; + this.Timestamp = timestamp; + } + + public NeuronInFlightCommand() + { + } + } +} + +Type File: 'NeuronInfo' + +using EdjCase.ICP.Candid.Mapping; +using System.Collections.Generic; +using Test.Models; +using EdjCase.ICP.Candid.Models; + +namespace Test.Models +{ + public class NeuronInfo + { + [CandidName("dissolve_delay_seconds")] + public ulong DissolveDelaySeconds { get; set; } + + [CandidName("recent_ballots")] + public List RecentBallots { get; set; } + + [CandidName("created_timestamp_seconds")] + public ulong CreatedTimestampSeconds { get; set; } + + [CandidName("state")] + public int State { get; set; } + + [CandidName("stake_e8s")] + public ulong StakeE8s { get; set; } + + [CandidName("joined_community_fund_timestamp_seconds")] + public OptionalValue JoinedCommunityFundTimestampSeconds { get; set; } + + [CandidName("retrieved_at_timestamp_seconds")] + public ulong RetrievedAtTimestampSeconds { get; set; } + + [CandidName("known_neuron_data")] + public OptionalValue KnownNeuronData { get; set; } + + [CandidName("voting_power")] + public ulong VotingPower { get; set; } + + [CandidName("age_seconds")] + public ulong AgeSeconds { get; set; } + + public NeuronInfo(ulong dissolveDelaySeconds, List recentBallots, ulong createdTimestampSeconds, int state, ulong stakeE8s, OptionalValue joinedCommunityFundTimestampSeconds, ulong retrievedAtTimestampSeconds, OptionalValue knownNeuronData, ulong votingPower, ulong ageSeconds) + { + this.DissolveDelaySeconds = dissolveDelaySeconds; + this.RecentBallots = recentBallots; + this.CreatedTimestampSeconds = createdTimestampSeconds; + this.State = state; + this.StakeE8s = stakeE8s; + this.JoinedCommunityFundTimestampSeconds = joinedCommunityFundTimestampSeconds; + this.RetrievedAtTimestampSeconds = retrievedAtTimestampSeconds; + this.KnownNeuronData = knownNeuronData; + this.VotingPower = votingPower; + this.AgeSeconds = ageSeconds; + } + + public NeuronInfo() + { + } + } +} + +Type File: 'NeuronStakeTransfer' + +using EdjCase.ICP.Candid.Mapping; +using System.Collections.Generic; +using EdjCase.ICP.Candid.Models; + +namespace Test.Models +{ + public class NeuronStakeTransfer + { + [CandidName("to_subaccount")] + public List ToSubaccount { get; set; } + + [CandidName("neuron_stake_e8s")] + public ulong NeuronStakeE8s { get; set; } + + [CandidName("from")] + public OptionalValue From { get; set; } + + [CandidName("memo")] + public ulong Memo { get; set; } + + [CandidName("from_subaccount")] + public List FromSubaccount { get; set; } + + [CandidName("transfer_timestamp")] + public ulong TransferTimestamp { get; set; } + + [CandidName("block_height")] + public ulong BlockHeight { get; set; } + + public NeuronStakeTransfer(List toSubaccount, ulong neuronStakeE8s, OptionalValue from, ulong memo, List fromSubaccount, ulong transferTimestamp, ulong blockHeight) + { + this.ToSubaccount = toSubaccount; + this.NeuronStakeE8s = neuronStakeE8s; + this.From = from; + this.Memo = memo; + this.FromSubaccount = fromSubaccount; + this.TransferTimestamp = transferTimestamp; + this.BlockHeight = blockHeight; + } + + public NeuronStakeTransfer() + { + } + } +} + +Type File: 'NodeProvider' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class NodeProvider + { + [CandidName("id")] + public OptionalValue Id { get; set; } + + [CandidName("reward_account")] + public OptionalValue RewardAccount { get; set; } + + public NodeProvider(OptionalValue id, OptionalValue rewardAccount) + { + this.Id = id; + this.RewardAccount = rewardAccount; + } + + public NodeProvider() + { + } + } +} + +Type File: 'Operation' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; + +namespace Test.Models +{ + [Variant()] + public class Operation + { + [VariantTagProperty()] + public OperationTag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public RemoveHotKey RemoveHotKey { get => this.Tag == OperationTag.RemoveHotKey ? (RemoveHotKey)this.Value! : default; set => (this.Tag, this.Value) = (OperationTag.RemoveHotKey, value); } + + public AddHotKey AddHotKey { get => this.Tag == OperationTag.AddHotKey ? (AddHotKey)this.Value! : default; set => (this.Tag, this.Value) = (OperationTag.AddHotKey, value); } + + public Operation.StopDissolvingInfo StopDissolving { get => this.Tag == OperationTag.StopDissolving ? (Operation.StopDissolvingInfo)this.Value! : default; set => (this.Tag, this.Value) = (OperationTag.StopDissolving, value); } + + public Operation.StartDissolvingInfo StartDissolving { get => this.Tag == OperationTag.StartDissolving ? (Operation.StartDissolvingInfo)this.Value! : default; set => (this.Tag, this.Value) = (OperationTag.StartDissolving, value); } + + public IncreaseDissolveDelay IncreaseDissolveDelay { get => this.Tag == OperationTag.IncreaseDissolveDelay ? (IncreaseDissolveDelay)this.Value! : default; set => (this.Tag, this.Value) = (OperationTag.IncreaseDissolveDelay, value); } + + public Operation.JoinCommunityFundInfo JoinCommunityFund { get => this.Tag == OperationTag.JoinCommunityFund ? (Operation.JoinCommunityFundInfo)this.Value! : default; set => (this.Tag, this.Value) = (OperationTag.JoinCommunityFund, value); } + + public SetDissolveTimestamp SetDissolveTimestamp { get => this.Tag == OperationTag.SetDissolveTimestamp ? (SetDissolveTimestamp)this.Value! : default; set => (this.Tag, this.Value) = (OperationTag.SetDissolveTimestamp, value); } + + public Operation(OperationTag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected Operation() + { + } + + public class StopDissolvingInfo + { + public StopDissolvingInfo() + { + } + } + + public class StartDissolvingInfo + { + public StartDissolvingInfo() + { + } + } + + public class JoinCommunityFundInfo + { + public JoinCommunityFundInfo() + { + } + } + } + + public enum OperationTag + { + RemoveHotKey, + AddHotKey, + StopDissolving, + StartDissolving, + IncreaseDissolveDelay, + JoinCommunityFund, + SetDissolveTimestamp + } +} + +Type File: 'Proposal' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class Proposal + { + [CandidName("url")] + public string Url { get; set; } + + [CandidName("title")] + public OptionalValue Title { get; set; } + + [CandidName("action")] + public OptionalValue Action { get; set; } + + [CandidName("summary")] + public string Summary { get; set; } + + public Proposal(string url, OptionalValue title, OptionalValue action, string summary) + { + this.Url = url; + this.Title = title; + this.Action = action; + this.Summary = summary; + } + + public Proposal() + { + } + } +} + +Type File: 'ProposalData' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test.Models; +using System.Collections.Generic; + +namespace Test.Models +{ + public class ProposalData + { + [CandidName("id")] + public OptionalValue Id { get; set; } + + [CandidName("failure_reason")] + public OptionalValue FailureReason { get; set; } + + [CandidName("ballots")] + public Dictionary Ballots { get; set; } + + [CandidName("proposal_timestamp_seconds")] + public ulong ProposalTimestampSeconds { get; set; } + + [CandidName("reward_event_round")] + public ulong RewardEventRound { get; set; } + + [CandidName("failed_timestamp_seconds")] + public ulong FailedTimestampSeconds { get; set; } + + [CandidName("reject_cost_e8s")] + public ulong RejectCostE8s { get; set; } + + [CandidName("latest_tally")] + public OptionalValue LatestTally { get; set; } + + [CandidName("decided_timestamp_seconds")] + public ulong DecidedTimestampSeconds { get; set; } + + [CandidName("proposal")] + public OptionalValue Proposal { get; set; } + + [CandidName("proposer")] + public OptionalValue Proposer { get; set; } + + [CandidName("wait_for_quiet_state")] + public OptionalValue WaitForQuietState { get; set; } + + [CandidName("executed_timestamp_seconds")] + public ulong ExecutedTimestampSeconds { get; set; } + + public ProposalData(OptionalValue id, OptionalValue failureReason, Dictionary ballots, ulong proposalTimestampSeconds, ulong rewardEventRound, ulong failedTimestampSeconds, ulong rejectCostE8s, OptionalValue latestTally, ulong decidedTimestampSeconds, OptionalValue proposal, OptionalValue proposer, OptionalValue waitForQuietState, ulong executedTimestampSeconds) + { + this.Id = id; + this.FailureReason = failureReason; + this.Ballots = ballots; + this.ProposalTimestampSeconds = proposalTimestampSeconds; + this.RewardEventRound = rewardEventRound; + this.FailedTimestampSeconds = failedTimestampSeconds; + this.RejectCostE8s = rejectCostE8s; + this.LatestTally = latestTally; + this.DecidedTimestampSeconds = decidedTimestampSeconds; + this.Proposal = proposal; + this.Proposer = proposer; + this.WaitForQuietState = waitForQuietState; + this.ExecutedTimestampSeconds = executedTimestampSeconds; + } + + public ProposalData() + { + } + } +} + +Type File: 'ProposalInfo' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test.Models; +using System.Collections.Generic; + +namespace Test.Models +{ + public class ProposalInfo + { + [CandidName("id")] + public OptionalValue Id { get; set; } + + [CandidName("status")] + public int Status { get; set; } + + [CandidName("topic")] + public int Topic { get; set; } + + [CandidName("failure_reason")] + public OptionalValue FailureReason { get; set; } + + [CandidName("ballots")] + public Dictionary Ballots { get; set; } + + [CandidName("proposal_timestamp_seconds")] + public ulong ProposalTimestampSeconds { get; set; } + + [CandidName("reward_event_round")] + public ulong RewardEventRound { get; set; } + + [CandidName("deadline_timestamp_seconds")] + public OptionalValue DeadlineTimestampSeconds { get; set; } + + [CandidName("failed_timestamp_seconds")] + public ulong FailedTimestampSeconds { get; set; } + + [CandidName("reject_cost_e8s")] + public ulong RejectCostE8s { get; set; } + + [CandidName("latest_tally")] + public OptionalValue LatestTally { get; set; } + + [CandidName("reward_status")] + public int RewardStatus { get; set; } + + [CandidName("decided_timestamp_seconds")] + public ulong DecidedTimestampSeconds { get; set; } + + [CandidName("proposal")] + public OptionalValue Proposal { get; set; } + + [CandidName("proposer")] + public OptionalValue Proposer { get; set; } + + [CandidName("executed_timestamp_seconds")] + public ulong ExecutedTimestampSeconds { get; set; } + + public ProposalInfo(OptionalValue id, int status, int topic, OptionalValue failureReason, Dictionary ballots, ulong proposalTimestampSeconds, ulong rewardEventRound, OptionalValue deadlineTimestampSeconds, ulong failedTimestampSeconds, ulong rejectCostE8s, OptionalValue latestTally, int rewardStatus, ulong decidedTimestampSeconds, OptionalValue proposal, OptionalValue proposer, ulong executedTimestampSeconds) + { + this.Id = id; + this.Status = status; + this.Topic = topic; + this.FailureReason = failureReason; + this.Ballots = ballots; + this.ProposalTimestampSeconds = proposalTimestampSeconds; + this.RewardEventRound = rewardEventRound; + this.DeadlineTimestampSeconds = deadlineTimestampSeconds; + this.FailedTimestampSeconds = failedTimestampSeconds; + this.RejectCostE8s = rejectCostE8s; + this.LatestTally = latestTally; + this.RewardStatus = rewardStatus; + this.DecidedTimestampSeconds = decidedTimestampSeconds; + this.Proposal = proposal; + this.Proposer = proposer; + this.ExecutedTimestampSeconds = executedTimestampSeconds; + } + + public ProposalInfo() + { + } + } +} + +Type File: 'RegisterVote' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class RegisterVote + { + [CandidName("vote")] + public int Vote { get; set; } + + [CandidName("proposal")] + public OptionalValue Proposal { get; set; } + + public RegisterVote(int vote, OptionalValue proposal) + { + this.Vote = vote; + this.Proposal = proposal; + } + + public RegisterVote() + { + } + } +} + +Type File: 'RemoveHotKey' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; + +namespace Test.Models +{ + public class RemoveHotKey + { + [CandidName("hot_key_to_remove")] + public OptionalValue HotKeyToRemove { get; set; } + + public RemoveHotKey(OptionalValue hotKeyToRemove) + { + this.HotKeyToRemove = hotKeyToRemove; + } + + public RemoveHotKey() + { + } + } +} + +Type File: 'Result' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; + +namespace Test.Models +{ + [Variant()] + public class Result + { + [VariantTagProperty()] + public ResultTag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public GovernanceError Err { get => this.Tag == ResultTag.Err ? (GovernanceError)this.Value! : default; set => (this.Tag, this.Value) = (ResultTag.Err, value); } + + public Result(ResultTag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected Result() + { + } + } + + public enum ResultTag + { + Ok, + Err + } +} + +Type File: 'Result1' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; + +namespace Test.Models +{ + [Variant()] + public class Result1 + { + [VariantTagProperty()] + public Result1Tag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public GovernanceError Error { get => this.Tag == Result1Tag.Error ? (GovernanceError)this.Value! : default; set => (this.Tag, this.Value) = (Result1Tag.Error, value); } + + public NeuronId NeuronId { get => this.Tag == Result1Tag.NeuronId ? (NeuronId)this.Value! : default; set => (this.Tag, this.Value) = (Result1Tag.NeuronId, value); } + + public Result1(Result1Tag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected Result1() + { + } + } + + public enum Result1Tag + { + Error, + NeuronId + } +} + +Type File: 'Result2' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; + +namespace Test.Models +{ + [Variant()] + public class Result2 + { + [VariantTagProperty()] + public Result2Tag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public Neuron Ok { get => this.Tag == Result2Tag.Ok ? (Neuron)this.Value! : default; set => (this.Tag, this.Value) = (Result2Tag.Ok, value); } + + public GovernanceError Err { get => this.Tag == Result2Tag.Err ? (GovernanceError)this.Value! : default; set => (this.Tag, this.Value) = (Result2Tag.Err, value); } + + public Result2(Result2Tag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected Result2() + { + } + } + + public enum Result2Tag + { + Ok, + Err + } +} + +Type File: 'Result3' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; + +namespace Test.Models +{ + [Variant()] + public class Result3 + { + [VariantTagProperty()] + public Result3Tag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public RewardNodeProviders Ok { get => this.Tag == Result3Tag.Ok ? (RewardNodeProviders)this.Value! : default; set => (this.Tag, this.Value) = (Result3Tag.Ok, value); } + + public GovernanceError Err { get => this.Tag == Result3Tag.Err ? (GovernanceError)this.Value! : default; set => (this.Tag, this.Value) = (Result3Tag.Err, value); } + + public Result3(Result3Tag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected Result3() + { + } + } + + public enum Result3Tag + { + Ok, + Err + } +} + +Type File: 'Result4' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; + +namespace Test.Models +{ + [Variant()] + public class Result4 + { + [VariantTagProperty()] + public Result4Tag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public NeuronInfo Ok { get => this.Tag == Result4Tag.Ok ? (NeuronInfo)this.Value! : default; set => (this.Tag, this.Value) = (Result4Tag.Ok, value); } + + public GovernanceError Err { get => this.Tag == Result4Tag.Err ? (GovernanceError)this.Value! : default; set => (this.Tag, this.Value) = (Result4Tag.Err, value); } + + public Result4(Result4Tag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected Result4() + { + } + } + + public enum Result4Tag + { + Ok, + Err + } +} + +Type File: 'Result5' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; + +namespace Test.Models +{ + [Variant()] + public class Result5 + { + [VariantTagProperty()] + public Result5Tag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public NodeProvider Ok { get => this.Tag == Result5Tag.Ok ? (NodeProvider)this.Value! : default; set => (this.Tag, this.Value) = (Result5Tag.Ok, value); } + + public GovernanceError Err { get => this.Tag == Result5Tag.Err ? (GovernanceError)this.Value! : default; set => (this.Tag, this.Value) = (Result5Tag.Err, value); } + + public Result5(Result5Tag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected Result5() + { + } + } + + public enum Result5Tag + { + Ok, + Err + } +} + +Type File: 'RewardEvent' + +using EdjCase.ICP.Candid.Mapping; +using System.Collections.Generic; +using Test.Models; + +namespace Test.Models +{ + public class RewardEvent + { + [CandidName("day_after_genesis")] + public ulong DayAfterGenesis { get; set; } + + [CandidName("actual_timestamp_seconds")] + public ulong ActualTimestampSeconds { get; set; } + + [CandidName("distributed_e8s_equivalent")] + public ulong DistributedE8sEquivalent { get; set; } + + [CandidName("settled_proposals")] + public List SettledProposals { get; set; } + + public RewardEvent(ulong dayAfterGenesis, ulong actualTimestampSeconds, ulong distributedE8sEquivalent, List settledProposals) + { + this.DayAfterGenesis = dayAfterGenesis; + this.ActualTimestampSeconds = actualTimestampSeconds; + this.DistributedE8sEquivalent = distributedE8sEquivalent; + this.SettledProposals = settledProposals; + } + + public RewardEvent() + { + } + } +} + +Type File: 'RewardMode' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; + +namespace Test.Models +{ + [Variant()] + public class RewardMode + { + [VariantTagProperty()] + public RewardModeTag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public RewardToNeuron RewardToNeuron { get => this.Tag == RewardModeTag.RewardToNeuron ? (RewardToNeuron)this.Value! : default; set => (this.Tag, this.Value) = (RewardModeTag.RewardToNeuron, value); } + + public RewardToAccount RewardToAccount { get => this.Tag == RewardModeTag.RewardToAccount ? (RewardToAccount)this.Value! : default; set => (this.Tag, this.Value) = (RewardModeTag.RewardToAccount, value); } + + public RewardMode(RewardModeTag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected RewardMode() + { + } + } + + public enum RewardModeTag + { + RewardToNeuron, + RewardToAccount + } +} + +Type File: 'RewardNodeProvider' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class RewardNodeProvider + { + [CandidName("node_provider")] + public OptionalValue NodeProvider { get; set; } + + [CandidName("reward_mode")] + public OptionalValue RewardMode { get; set; } + + [CandidName("amount_e8s")] + public ulong AmountE8s { get; set; } + + public RewardNodeProvider(OptionalValue nodeProvider, OptionalValue rewardMode, ulong amountE8s) + { + this.NodeProvider = nodeProvider; + this.RewardMode = rewardMode; + this.AmountE8s = amountE8s; + } + + public RewardNodeProvider() + { + } + } +} + +Type File: 'RewardNodeProviders' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using System.Collections.Generic; +using Test.Models; + +namespace Test.Models +{ + public class RewardNodeProviders + { + [CandidName("use_registry_derived_rewards")] + public OptionalValue UseRegistryDerivedRewards { get; set; } + + [CandidName("rewards")] + public List Rewards { get; set; } + + public RewardNodeProviders(OptionalValue useRegistryDerivedRewards, List rewards) + { + this.UseRegistryDerivedRewards = useRegistryDerivedRewards; + this.Rewards = rewards; + } + + public RewardNodeProviders() + { + } + } +} + +Type File: 'RewardToAccount' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class RewardToAccount + { + [CandidName("to_account")] + public OptionalValue ToAccount { get; set; } + + public RewardToAccount(OptionalValue toAccount) + { + this.ToAccount = toAccount; + } + + public RewardToAccount() + { + } + } +} + +Type File: 'RewardToNeuron' + +using EdjCase.ICP.Candid.Mapping; + +namespace Test.Models +{ + public class RewardToNeuron + { + [CandidName("dissolve_delay_seconds")] + public ulong DissolveDelaySeconds { get; set; } + + public RewardToNeuron(ulong dissolveDelaySeconds) + { + this.DissolveDelaySeconds = dissolveDelaySeconds; + } + + public RewardToNeuron() + { + } + } +} + +Type File: 'SetDefaultFollowees' + +using EdjCase.ICP.Candid.Mapping; +using System.Collections.Generic; +using Test.Models; + +namespace Test.Models +{ + public class SetDefaultFollowees + { + [CandidName("default_followees")] + public Dictionary DefaultFollowees { get; set; } + + public SetDefaultFollowees(Dictionary defaultFollowees) + { + this.DefaultFollowees = defaultFollowees; + } + + public SetDefaultFollowees() + { + } + } +} + +Type File: 'SetDissolveTimestamp' + +using EdjCase.ICP.Candid.Mapping; + +namespace Test.Models +{ + public class SetDissolveTimestamp + { + [CandidName("dissolve_timestamp_seconds")] + public ulong DissolveTimestampSeconds { get; set; } + + public SetDissolveTimestamp(ulong dissolveTimestampSeconds) + { + this.DissolveTimestampSeconds = dissolveTimestampSeconds; + } + + public SetDissolveTimestamp() + { + } + } +} + +Type File: 'Spawn' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; + +namespace Test.Models +{ + public class Spawn + { + [CandidName("percentage_to_spawn")] + public OptionalValue PercentageToSpawn { get; set; } + + [CandidName("new_controller")] + public OptionalValue NewController { get; set; } + + [CandidName("nonce")] + public OptionalValue Nonce { get; set; } + + public Spawn(OptionalValue percentageToSpawn, OptionalValue newController, OptionalValue nonce) + { + this.PercentageToSpawn = percentageToSpawn; + this.NewController = newController; + this.Nonce = nonce; + } + + public Spawn() + { + } + } +} + +Type File: 'SpawnResponse' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class SpawnResponse + { + [CandidName("created_neuron_id")] + public OptionalValue CreatedNeuronId { get; set; } + + public SpawnResponse(OptionalValue createdNeuronId) + { + this.CreatedNeuronId = createdNeuronId; + } + + public SpawnResponse() + { + } + } +} + +Type File: 'Split' + +using EdjCase.ICP.Candid.Mapping; + +namespace Test.Models +{ + public class Split + { + [CandidName("amount_e8s")] + public ulong AmountE8s { get; set; } + + public Split(ulong amountE8s) + { + this.AmountE8s = amountE8s; + } + + public Split() + { + } + } +} + +Type File: 'Tally' + +using EdjCase.ICP.Candid.Mapping; + +namespace Test.Models +{ + public class Tally + { + [CandidName("no")] + public ulong No { get; set; } + + [CandidName("yes")] + public ulong Yes { get; set; } + + [CandidName("total")] + public ulong Total { get; set; } + + [CandidName("timestamp_seconds")] + public ulong TimestampSeconds { get; set; } + + public Tally(ulong no, ulong yes, ulong total, ulong timestampSeconds) + { + this.No = no; + this.Yes = yes; + this.Total = total; + this.TimestampSeconds = timestampSeconds; + } + + public Tally() + { + } + } +} + +Type File: 'UpdateNodeProvider' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class UpdateNodeProvider + { + [CandidName("reward_account")] + public OptionalValue RewardAccount { get; set; } + + public UpdateNodeProvider(OptionalValue rewardAccount) + { + this.RewardAccount = rewardAccount; + } + + public UpdateNodeProvider() + { + } + } +} + +Type File: 'WaitForQuietState' + +using EdjCase.ICP.Candid.Mapping; + +namespace Test.Models +{ + public class WaitForQuietState + { + [CandidName("current_deadline_timestamp_seconds")] + public ulong CurrentDeadlineTimestampSeconds { get; set; } + + public WaitForQuietState(ulong currentDeadlineTimestampSeconds) + { + this.CurrentDeadlineTimestampSeconds = currentDeadlineTimestampSeconds; + } + + public WaitForQuietState() + { + } + } +} diff --git a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_False_KeepCandidCase_True.snap b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False.snap similarity index 95% rename from test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_False_KeepCandidCase_True.snap rename to test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False.snap index 29e1324d..2990e855 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_False_KeepCandidCase_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False.snap @@ -208,7 +208,7 @@ using System; namespace Test.Models { - [Variant(typeof(ActionTag))] + [Variant()] public class Action { [VariantTagProperty()] @@ -348,25 +348,15 @@ namespace Test.Models public enum ActionTag { - [VariantOptionType(typeof(KnownNeuron))] RegisterKnownNeuron, - [VariantOptionType(typeof(ManageNeuron))] ManageNeuron, - [VariantOptionType(typeof(ExecuteNnsFunction))] ExecuteNnsFunction, - [VariantOptionType(typeof(RewardNodeProvider))] RewardNodeProvider, - [VariantOptionType(typeof(SetDefaultFollowees))] SetDefaultFollowees, - [VariantOptionType(typeof(RewardNodeProviders))] RewardNodeProviders, - [VariantOptionType(typeof(NetworkEconomics))] ManageNetworkEconomics, - [VariantOptionType(typeof(ApproveGenesisKyc))] ApproveGenesisKyc, - [VariantOptionType(typeof(AddOrRemoveNodeProvider))] AddOrRemoveNodeProvider, - [VariantOptionType(typeof(Motion))] Motion } } @@ -510,7 +500,7 @@ using System; namespace Test.Models { - [Variant(typeof(ByTag))] + [Variant()] public class By { [VariantTagProperty()] @@ -580,11 +570,8 @@ namespace Test.Models public enum ByTag { - [VariantOptionType(typeof(By.NeuronIdOrSubaccountInfo))] NeuronIdOrSubaccount, - [VariantOptionType(typeof(ClaimOrRefreshNeuronFromAccount))] MemoAndController, - [VariantOptionType(typeof(ulong))] Memo } } @@ -597,7 +584,7 @@ using System; namespace Test.Models { - [Variant(typeof(ChangeTag))] + [Variant()] public class Change { [VariantTagProperty()] @@ -649,9 +636,7 @@ namespace Test.Models public enum ChangeTag { - [VariantOptionType(typeof(NodeProvider))] ToRemove, - [VariantOptionType(typeof(NodeProvider))] ToAdd } } @@ -754,7 +739,7 @@ using System; namespace Test.Models { - [Variant(typeof(CommandTag))] + [Variant()] public class Command { [VariantTagProperty()] @@ -905,27 +890,16 @@ namespace Test.Models public enum CommandTag { - [VariantOptionType(typeof(Spawn))] Spawn, - [VariantOptionType(typeof(Split))] Split, - [VariantOptionType(typeof(Follow))] Follow, - [VariantOptionType(typeof(ClaimOrRefresh))] ClaimOrRefresh, - [VariantOptionType(typeof(Configure))] Configure, - [VariantOptionType(typeof(RegisterVote))] RegisterVote, - [VariantOptionType(typeof(Merge))] Merge, - [VariantOptionType(typeof(DisburseToNeuron))] DisburseToNeuron, - [VariantOptionType(typeof(Proposal))] MakeProposal, - [VariantOptionType(typeof(MergeMaturity))] MergeMaturity, - [VariantOptionType(typeof(Disburse))] Disburse } } @@ -938,7 +912,7 @@ using System; namespace Test.Models { - [Variant(typeof(Command_1Tag))] + [Variant()] public class Command_1 { [VariantTagProperty()] @@ -1128,29 +1102,17 @@ namespace Test.Models public enum Command_1Tag { - [VariantOptionType(typeof(GovernanceError))] Error, - [VariantOptionType(typeof(SpawnResponse))] Spawn, - [VariantOptionType(typeof(SpawnResponse))] Split, - [VariantOptionType(typeof(Command_1.FollowInfo))] Follow, - [VariantOptionType(typeof(ClaimOrRefreshResponse))] ClaimOrRefresh, - [VariantOptionType(typeof(Command_1.ConfigureInfo))] Configure, - [VariantOptionType(typeof(Command_1.RegisterVoteInfo))] RegisterVote, - [VariantOptionType(typeof(Command_1.MergeInfo))] Merge, - [VariantOptionType(typeof(SpawnResponse))] DisburseToNeuron, - [VariantOptionType(typeof(MakeProposalResponse))] MakeProposal, - [VariantOptionType(typeof(MergeMaturityResponse))] MergeMaturity, - [VariantOptionType(typeof(DisburseResponse))] Disburse } } @@ -1163,7 +1125,7 @@ using System; namespace Test.Models { - [Variant(typeof(Command_2Tag))] + [Variant()] public class Command_2 { [VariantTagProperty()] @@ -1281,21 +1243,13 @@ namespace Test.Models public enum Command_2Tag { - [VariantOptionType(typeof(Spawn))] Spawn, - [VariantOptionType(typeof(Split))] Split, - [VariantOptionType(typeof(Configure))] Configure, - [VariantOptionType(typeof(Merge))] Merge, - [VariantOptionType(typeof(DisburseToNeuron))] DisburseToNeuron, - [VariantOptionType(typeof(ClaimOrRefresh))] ClaimOrRefreshNeuron, - [VariantOptionType(typeof(MergeMaturity))] MergeMaturity, - [VariantOptionType(typeof(Disburse))] Disburse } } @@ -1407,7 +1361,7 @@ using System; namespace Test.Models { - [Variant(typeof(DissolveStateTag))] + [Variant()] public class DissolveState { [VariantTagProperty()] @@ -1459,9 +1413,7 @@ namespace Test.Models public enum DissolveStateTag { - [VariantOptionType(typeof(ulong))] DissolveDelaySeconds, - [VariantOptionType(typeof(ulong))] WhenDissolvedTimestampSeconds } } @@ -2192,7 +2144,7 @@ using System; namespace Test.Models { - [Variant(typeof(NeuronIdOrSubaccountTag))] + [Variant()] public class NeuronIdOrSubaccount { [VariantTagProperty()] @@ -2244,9 +2196,7 @@ namespace Test.Models public enum NeuronIdOrSubaccountTag { - [VariantOptionType(typeof(List))] Subaccount, - [VariantOptionType(typeof(NeuronId))] NeuronId } } @@ -2399,7 +2349,7 @@ using System; namespace Test.Models { - [Variant(typeof(OperationTag))] + [Variant()] public class Operation { [VariantTagProperty()] @@ -2527,19 +2477,12 @@ namespace Test.Models public enum OperationTag { - [VariantOptionType(typeof(RemoveHotKey))] RemoveHotKey, - [VariantOptionType(typeof(AddHotKey))] AddHotKey, - [VariantOptionType(typeof(Operation.StopDissolvingInfo))] StopDissolving, - [VariantOptionType(typeof(Operation.StartDissolvingInfo))] StartDissolving, - [VariantOptionType(typeof(IncreaseDissolveDelay))] IncreaseDissolveDelay, - [VariantOptionType(typeof(Operation.JoinCommunityFundInfo))] JoinCommunityFund, - [VariantOptionType(typeof(SetDissolveTimestamp))] SetDissolveTimestamp } } @@ -2756,7 +2699,7 @@ using System; namespace Test.Models { - [Variant(typeof(ResultTag))] + [Variant()] public class Result { [VariantTagProperty()] @@ -2803,7 +2746,6 @@ namespace Test.Models public enum ResultTag { Ok, - [VariantOptionType(typeof(GovernanceError))] Err } } @@ -2816,7 +2758,7 @@ using System; namespace Test.Models { - [Variant(typeof(Result_1Tag))] + [Variant()] public class Result_1 { [VariantTagProperty()] @@ -2868,9 +2810,7 @@ namespace Test.Models public enum Result_1Tag { - [VariantOptionType(typeof(GovernanceError))] Error, - [VariantOptionType(typeof(NeuronId))] NeuronId } } @@ -2883,7 +2823,7 @@ using System; namespace Test.Models { - [Variant(typeof(Result_2Tag))] + [Variant()] public class Result_2 { [VariantTagProperty()] @@ -2935,9 +2875,7 @@ namespace Test.Models public enum Result_2Tag { - [VariantOptionType(typeof(Neuron))] Ok, - [VariantOptionType(typeof(GovernanceError))] Err } } @@ -2950,7 +2888,7 @@ using System; namespace Test.Models { - [Variant(typeof(Result_3Tag))] + [Variant()] public class Result_3 { [VariantTagProperty()] @@ -3002,9 +2940,7 @@ namespace Test.Models public enum Result_3Tag { - [VariantOptionType(typeof(RewardNodeProviders))] Ok, - [VariantOptionType(typeof(GovernanceError))] Err } } @@ -3017,7 +2953,7 @@ using System; namespace Test.Models { - [Variant(typeof(Result_4Tag))] + [Variant()] public class Result_4 { [VariantTagProperty()] @@ -3069,9 +3005,7 @@ namespace Test.Models public enum Result_4Tag { - [VariantOptionType(typeof(NeuronInfo))] Ok, - [VariantOptionType(typeof(GovernanceError))] Err } } @@ -3084,7 +3018,7 @@ using System; namespace Test.Models { - [Variant(typeof(Result_5Tag))] + [Variant()] public class Result_5 { [VariantTagProperty()] @@ -3136,9 +3070,7 @@ namespace Test.Models public enum Result_5Tag { - [VariantOptionType(typeof(NodeProvider))] Ok, - [VariantOptionType(typeof(GovernanceError))] Err } } @@ -3182,7 +3114,7 @@ using System; namespace Test.Models { - [Variant(typeof(RewardModeTag))] + [Variant()] public class RewardMode { [VariantTagProperty()] @@ -3234,9 +3166,7 @@ namespace Test.Models public enum RewardModeTag { - [VariantOptionType(typeof(RewardToNeuron))] RewardToNeuron, - [VariantOptionType(typeof(RewardToAccount))] RewardToAccount } } diff --git a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True.snap b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True.snap new file mode 100644 index 00000000..6dca60d5 --- /dev/null +++ b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True.snap @@ -0,0 +1,2666 @@ +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 +{ + public class GovernanceApiClient + { + public IAgent Agent { get; } + + public Principal CanisterId { get; } + + public CandidConverter Converter { get; } + + public GovernanceApiClient(IAgent agent, Principal canisterId, CandidConverter converter = default) + { + this.Agent = agent; + this.CanisterId = canisterId; + this.Converter = converter; + } + + public async Task claim_gtc_neurons(Principal arg0, List arg1) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0), CandidTypedValue.FromObject(arg1)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "claim_gtc_neurons", arg); + return reply.ToObjects(this.Converter); + } + + public async Task claim_or_refresh_neuron_from_account(Models.ClaimOrRefreshNeuronFromAccount arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "claim_or_refresh_neuron_from_account", arg); + return reply.ToObjects(this.Converter); + } + + 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(); + return reply.ToObjects(this.Converter); + } + + public async Task _get_full_neuron(ulong arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron", arg); + CandidArg reply = response.ThrowOrGetReply(); + 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)); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron_by_id_or_subaccount", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + + public async Task _get_monthly_node_provider_rewards() + { + CandidArg arg = CandidArg.FromCandid(); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "get_monthly_node_provider_rewards", arg); + return reply.ToObjects(this.Converter); + } + + 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(); + 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(); + return reply.ToObjects>(this.Converter); + } + + public async Task _get_neuron_info(ulong arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info", arg); + CandidArg reply = response.ThrowOrGetReply(); + 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)); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info_by_id_or_subaccount", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + + public async Task _get_node_provider_by_caller(NullValue arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_node_provider_by_caller", arg); + CandidArg reply = response.ThrowOrGetReply(); + 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(); + return reply.ToObjects>(this.Converter); + } + + public async Task> _get_proposal_info(ulong arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_proposal_info", arg); + CandidArg reply = response.ThrowOrGetReply(); + 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(); + return reply.ToObjects(this.Converter); + } + + public async Task list_neurons(Models.ListNeurons arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_neurons", arg); + CandidArg reply = response.ThrowOrGetReply(); + 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(); + return reply.ToObjects(this.Converter); + } + + public async Task list_proposals(Models.ListProposalInfo arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_proposals", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + + public async Task manage_neuron(Models.ManageNeuron arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "manage_neuron", arg); + return reply.ToObjects(this.Converter); + } + + public async Task transfer_gtc_neuron(Models.NeuronId arg0, Models.NeuronId arg1) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0), CandidTypedValue.FromObject(arg1)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "transfer_gtc_neuron", arg); + return reply.ToObjects(this.Converter); + } + + public async Task update_node_provider(Models.UpdateNodeProvider arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "update_node_provider", arg); + return reply.ToObjects(this.Converter); + } + } +} + +Type File: 'AccountIdentifier' + +using System.Collections.Generic; + +namespace Test.Models +{ + public class AccountIdentifier + { + public List hash { get; set; } + + public AccountIdentifier(List hash) + { + this.hash = hash; + } + + public AccountIdentifier() + { + } + } +} + +Type File: 'Action' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; + +namespace Test.Models +{ + [Variant()] + public class Action + { + [VariantTagProperty()] + public ActionTag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public KnownNeuron RegisterKnownNeuron { get => this.Tag == ActionTag.RegisterKnownNeuron ? (KnownNeuron)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.RegisterKnownNeuron, value); } + + public ManageNeuron ManageNeuron { get => this.Tag == ActionTag.ManageNeuron ? (ManageNeuron)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.ManageNeuron, value); } + + public ExecuteNnsFunction ExecuteNnsFunction { get => this.Tag == ActionTag.ExecuteNnsFunction ? (ExecuteNnsFunction)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.ExecuteNnsFunction, value); } + + public RewardNodeProvider RewardNodeProvider { get => this.Tag == ActionTag.RewardNodeProvider ? (RewardNodeProvider)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.RewardNodeProvider, value); } + + public SetDefaultFollowees SetDefaultFollowees { get => this.Tag == ActionTag.SetDefaultFollowees ? (SetDefaultFollowees)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.SetDefaultFollowees, value); } + + public RewardNodeProviders RewardNodeProviders { get => this.Tag == ActionTag.RewardNodeProviders ? (RewardNodeProviders)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.RewardNodeProviders, value); } + + public NetworkEconomics ManageNetworkEconomics { get => this.Tag == ActionTag.ManageNetworkEconomics ? (NetworkEconomics)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.ManageNetworkEconomics, value); } + + public ApproveGenesisKyc ApproveGenesisKyc { get => this.Tag == ActionTag.ApproveGenesisKyc ? (ApproveGenesisKyc)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.ApproveGenesisKyc, value); } + + public AddOrRemoveNodeProvider AddOrRemoveNodeProvider { get => this.Tag == ActionTag.AddOrRemoveNodeProvider ? (AddOrRemoveNodeProvider)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.AddOrRemoveNodeProvider, value); } + + public Motion Motion { get => this.Tag == ActionTag.Motion ? (Motion)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.Motion, value); } + + public Action(ActionTag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected Action() + { + } + } + + public enum ActionTag + { + RegisterKnownNeuron, + ManageNeuron, + ExecuteNnsFunction, + RewardNodeProvider, + SetDefaultFollowees, + RewardNodeProviders, + ManageNetworkEconomics, + ApproveGenesisKyc, + AddOrRemoveNodeProvider, + Motion + } +} + +Type File: 'AddHotKey' + +using EdjCase.ICP.Candid.Models; + +namespace Test.Models +{ + public class AddHotKey + { + public OptionalValue new_hot_key { get; set; } + + public AddHotKey(OptionalValue newHotKey) + { + this.new_hot_key = newHotKey; + } + + public AddHotKey() + { + } + } +} + +Type File: 'AddOrRemoveNodeProvider' + +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class AddOrRemoveNodeProvider + { + public OptionalValue change { get; set; } + + public AddOrRemoveNodeProvider(OptionalValue change) + { + this.change = change; + } + + public AddOrRemoveNodeProvider() + { + } + } +} + +Type File: 'Amount' + +namespace Test.Models +{ + public class Amount + { + public ulong e8s { get; set; } + + public Amount(ulong e8s) + { + this.e8s = e8s; + } + + public Amount() + { + } + } +} + +Type File: 'ApproveGenesisKyc' + +using System.Collections.Generic; +using EdjCase.ICP.Candid.Models; + +namespace Test.Models +{ + public class ApproveGenesisKyc + { + public List principals { get; set; } + + public ApproveGenesisKyc(List principals) + { + this.principals = principals; + } + + public ApproveGenesisKyc() + { + } + } +} + +Type File: 'Ballot' + +namespace Test.Models +{ + public class Ballot + { + public int vote { get; set; } + + public ulong voting_power { get; set; } + + public Ballot(int vote, ulong votingPower) + { + this.vote = vote; + this.voting_power = votingPower; + } + + public Ballot() + { + } + } +} + +Type File: 'BallotInfo' + +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class BallotInfo + { + public int vote { get; set; } + + public OptionalValue proposal_id { get; set; } + + public BallotInfo(int vote, OptionalValue proposalId) + { + this.vote = vote; + this.proposal_id = proposalId; + } + + public BallotInfo() + { + } + } +} + +Type File: 'By' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; + +namespace Test.Models +{ + [Variant()] + public class By + { + [VariantTagProperty()] + public ByTag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public By.NeuronIdOrSubaccountInfo NeuronIdOrSubaccount { get => this.Tag == ByTag.NeuronIdOrSubaccount ? (By.NeuronIdOrSubaccountInfo)this.Value! : default; set => (this.Tag, this.Value) = (ByTag.NeuronIdOrSubaccount, value); } + + public ClaimOrRefreshNeuronFromAccount MemoAndController { get => this.Tag == ByTag.MemoAndController ? (ClaimOrRefreshNeuronFromAccount)this.Value! : default; set => (this.Tag, this.Value) = (ByTag.MemoAndController, value); } + + public ulong Memo { get => this.Tag == ByTag.Memo ? (ulong)this.Value! : default; set => (this.Tag, this.Value) = (ByTag.Memo, value); } + + public By(ByTag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected By() + { + } + + public class NeuronIdOrSubaccountInfo + { + public NeuronIdOrSubaccountInfo() + { + } + } + } + + public enum ByTag + { + NeuronIdOrSubaccount, + MemoAndController, + Memo + } +} + +Type File: 'Change' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; + +namespace Test.Models +{ + [Variant()] + public class Change + { + [VariantTagProperty()] + public ChangeTag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public NodeProvider ToRemove { get => this.Tag == ChangeTag.ToRemove ? (NodeProvider)this.Value! : default; set => (this.Tag, this.Value) = (ChangeTag.ToRemove, value); } + + public NodeProvider ToAdd { get => this.Tag == ChangeTag.ToAdd ? (NodeProvider)this.Value! : default; set => (this.Tag, this.Value) = (ChangeTag.ToAdd, value); } + + public Change(ChangeTag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected Change() + { + } + } + + public enum ChangeTag + { + ToRemove, + ToAdd + } +} + +Type File: 'ClaimOrRefresh' + +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class ClaimOrRefresh + { + public OptionalValue by { get; set; } + + public ClaimOrRefresh(OptionalValue by) + { + this.by = by; + } + + public ClaimOrRefresh() + { + } + } +} + +Type File: 'ClaimOrRefreshNeuronFromAccount' + +using EdjCase.ICP.Candid.Models; + +namespace Test.Models +{ + public class ClaimOrRefreshNeuronFromAccount + { + public OptionalValue controller { get; set; } + + public ulong memo { get; set; } + + public ClaimOrRefreshNeuronFromAccount(OptionalValue controller, ulong memo) + { + this.controller = controller; + this.memo = memo; + } + + public ClaimOrRefreshNeuronFromAccount() + { + } + } +} + +Type File: 'ClaimOrRefreshNeuronFromAccountResponse' + +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class ClaimOrRefreshNeuronFromAccountResponse + { + public OptionalValue result { get; set; } + + public ClaimOrRefreshNeuronFromAccountResponse(OptionalValue result) + { + this.result = result; + } + + public ClaimOrRefreshNeuronFromAccountResponse() + { + } + } +} + +Type File: 'ClaimOrRefreshResponse' + +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class ClaimOrRefreshResponse + { + public OptionalValue refreshed_neuron_id { get; set; } + + public ClaimOrRefreshResponse(OptionalValue refreshedNeuronId) + { + this.refreshed_neuron_id = refreshedNeuronId; + } + + public ClaimOrRefreshResponse() + { + } + } +} + +Type File: 'Command' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; + +namespace Test.Models +{ + [Variant()] + public class Command + { + [VariantTagProperty()] + public CommandTag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public Spawn Spawn { get => this.Tag == CommandTag.Spawn ? (Spawn)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.Spawn, value); } + + public Split Split { get => this.Tag == CommandTag.Split ? (Split)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.Split, value); } + + public Follow Follow { get => this.Tag == CommandTag.Follow ? (Follow)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.Follow, value); } + + public ClaimOrRefresh ClaimOrRefresh { get => this.Tag == CommandTag.ClaimOrRefresh ? (ClaimOrRefresh)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.ClaimOrRefresh, value); } + + public Configure Configure { get => this.Tag == CommandTag.Configure ? (Configure)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.Configure, value); } + + public RegisterVote RegisterVote { get => this.Tag == CommandTag.RegisterVote ? (RegisterVote)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.RegisterVote, value); } + + public Merge Merge { get => this.Tag == CommandTag.Merge ? (Merge)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.Merge, value); } + + public DisburseToNeuron DisburseToNeuron { get => this.Tag == CommandTag.DisburseToNeuron ? (DisburseToNeuron)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.DisburseToNeuron, value); } + + public Proposal MakeProposal { get => this.Tag == CommandTag.MakeProposal ? (Proposal)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.MakeProposal, value); } + + public MergeMaturity MergeMaturity { get => this.Tag == CommandTag.MergeMaturity ? (MergeMaturity)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.MergeMaturity, value); } + + public Disburse Disburse { get => this.Tag == CommandTag.Disburse ? (Disburse)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.Disburse, value); } + + public Command(CommandTag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected Command() + { + } + } + + public enum CommandTag + { + Spawn, + Split, + Follow, + ClaimOrRefresh, + Configure, + RegisterVote, + Merge, + DisburseToNeuron, + MakeProposal, + MergeMaturity, + Disburse + } +} + +Type File: 'Command_1' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; + +namespace Test.Models +{ + [Variant()] + public class Command_1 + { + [VariantTagProperty()] + public Command_1Tag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public GovernanceError Error { get => this.Tag == Command_1Tag.Error ? (GovernanceError)this.Value! : default; set => (this.Tag, this.Value) = (Command_1Tag.Error, value); } + + public SpawnResponse Spawn { get => this.Tag == Command_1Tag.Spawn ? (SpawnResponse)this.Value! : default; set => (this.Tag, this.Value) = (Command_1Tag.Spawn, value); } + + public SpawnResponse Split { get => this.Tag == Command_1Tag.Split ? (SpawnResponse)this.Value! : default; set => (this.Tag, this.Value) = (Command_1Tag.Split, value); } + + public Command_1.FollowInfo Follow { get => this.Tag == Command_1Tag.Follow ? (Command_1.FollowInfo)this.Value! : default; set => (this.Tag, this.Value) = (Command_1Tag.Follow, value); } + + public ClaimOrRefreshResponse ClaimOrRefresh { get => this.Tag == Command_1Tag.ClaimOrRefresh ? (ClaimOrRefreshResponse)this.Value! : default; set => (this.Tag, this.Value) = (Command_1Tag.ClaimOrRefresh, value); } + + public Command_1.ConfigureInfo Configure { get => this.Tag == Command_1Tag.Configure ? (Command_1.ConfigureInfo)this.Value! : default; set => (this.Tag, this.Value) = (Command_1Tag.Configure, value); } + + public Command_1.RegisterVoteInfo RegisterVote { get => this.Tag == Command_1Tag.RegisterVote ? (Command_1.RegisterVoteInfo)this.Value! : default; set => (this.Tag, this.Value) = (Command_1Tag.RegisterVote, value); } + + public Command_1.MergeInfo Merge { get => this.Tag == Command_1Tag.Merge ? (Command_1.MergeInfo)this.Value! : default; set => (this.Tag, this.Value) = (Command_1Tag.Merge, value); } + + public SpawnResponse DisburseToNeuron { get => this.Tag == Command_1Tag.DisburseToNeuron ? (SpawnResponse)this.Value! : default; set => (this.Tag, this.Value) = (Command_1Tag.DisburseToNeuron, value); } + + public MakeProposalResponse MakeProposal { get => this.Tag == Command_1Tag.MakeProposal ? (MakeProposalResponse)this.Value! : default; set => (this.Tag, this.Value) = (Command_1Tag.MakeProposal, value); } + + public MergeMaturityResponse MergeMaturity { get => this.Tag == Command_1Tag.MergeMaturity ? (MergeMaturityResponse)this.Value! : default; set => (this.Tag, this.Value) = (Command_1Tag.MergeMaturity, value); } + + public DisburseResponse Disburse { get => this.Tag == Command_1Tag.Disburse ? (DisburseResponse)this.Value! : default; set => (this.Tag, this.Value) = (Command_1Tag.Disburse, value); } + + public Command_1(Command_1Tag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected Command_1() + { + } + + public class FollowInfo + { + public FollowInfo() + { + } + } + + public class ConfigureInfo + { + public ConfigureInfo() + { + } + } + + public class RegisterVoteInfo + { + public RegisterVoteInfo() + { + } + } + + public class MergeInfo + { + public MergeInfo() + { + } + } + } + + public enum Command_1Tag + { + Error, + Spawn, + Split, + Follow, + ClaimOrRefresh, + Configure, + RegisterVote, + Merge, + DisburseToNeuron, + MakeProposal, + MergeMaturity, + Disburse + } +} + +Type File: 'Command_2' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; + +namespace Test.Models +{ + [Variant()] + public class Command_2 + { + [VariantTagProperty()] + public Command_2Tag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public Spawn Spawn { get => this.Tag == Command_2Tag.Spawn ? (Spawn)this.Value! : default; set => (this.Tag, this.Value) = (Command_2Tag.Spawn, value); } + + public Split Split { get => this.Tag == Command_2Tag.Split ? (Split)this.Value! : default; set => (this.Tag, this.Value) = (Command_2Tag.Split, value); } + + public Configure Configure { get => this.Tag == Command_2Tag.Configure ? (Configure)this.Value! : default; set => (this.Tag, this.Value) = (Command_2Tag.Configure, value); } + + public Merge Merge { get => this.Tag == Command_2Tag.Merge ? (Merge)this.Value! : default; set => (this.Tag, this.Value) = (Command_2Tag.Merge, value); } + + public DisburseToNeuron DisburseToNeuron { get => this.Tag == Command_2Tag.DisburseToNeuron ? (DisburseToNeuron)this.Value! : default; set => (this.Tag, this.Value) = (Command_2Tag.DisburseToNeuron, value); } + + public ClaimOrRefresh ClaimOrRefreshNeuron { get => this.Tag == Command_2Tag.ClaimOrRefreshNeuron ? (ClaimOrRefresh)this.Value! : default; set => (this.Tag, this.Value) = (Command_2Tag.ClaimOrRefreshNeuron, value); } + + public MergeMaturity MergeMaturity { get => this.Tag == Command_2Tag.MergeMaturity ? (MergeMaturity)this.Value! : default; set => (this.Tag, this.Value) = (Command_2Tag.MergeMaturity, value); } + + public Disburse Disburse { get => this.Tag == Command_2Tag.Disburse ? (Disburse)this.Value! : default; set => (this.Tag, this.Value) = (Command_2Tag.Disburse, value); } + + public Command_2(Command_2Tag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected Command_2() + { + } + } + + public enum Command_2Tag + { + Spawn, + Split, + Configure, + Merge, + DisburseToNeuron, + ClaimOrRefreshNeuron, + MergeMaturity, + Disburse + } +} + +Type File: 'Configure' + +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class Configure + { + public OptionalValue operation { get; set; } + + public Configure(OptionalValue operation) + { + this.operation = operation; + } + + public Configure() + { + } + } +} + +Type File: 'Disburse' + +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class Disburse + { + public OptionalValue to_account { get; set; } + + public OptionalValue amount { get; set; } + + public Disburse(OptionalValue toAccount, OptionalValue amount) + { + this.to_account = toAccount; + this.amount = amount; + } + + public Disburse() + { + } + } +} + +Type File: 'DisburseResponse' + +namespace Test.Models +{ + public class DisburseResponse + { + public ulong transfer_block_height { get; set; } + + public DisburseResponse(ulong transferBlockHeight) + { + this.transfer_block_height = transferBlockHeight; + } + + public DisburseResponse() + { + } + } +} + +Type File: 'DisburseToNeuron' + +using EdjCase.ICP.Candid.Models; + +namespace Test.Models +{ + public class DisburseToNeuron + { + public ulong dissolve_delay_seconds { get; set; } + + public bool kyc_verified { get; set; } + + public ulong amount_e8s { get; set; } + + public OptionalValue new_controller { get; set; } + + public ulong nonce { get; set; } + + public DisburseToNeuron(ulong dissolveDelaySeconds, bool kycVerified, ulong amountE8s, OptionalValue newController, ulong nonce) + { + this.dissolve_delay_seconds = dissolveDelaySeconds; + this.kyc_verified = kycVerified; + this.amount_e8s = amountE8s; + this.new_controller = newController; + this.nonce = nonce; + } + + public DisburseToNeuron() + { + } + } +} + +Type File: 'DissolveState' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; + +namespace Test.Models +{ + [Variant()] + public class DissolveState + { + [VariantTagProperty()] + public DissolveStateTag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public ulong DissolveDelaySeconds { get => this.Tag == DissolveStateTag.DissolveDelaySeconds ? (ulong)this.Value! : default; set => (this.Tag, this.Value) = (DissolveStateTag.DissolveDelaySeconds, value); } + + public ulong WhenDissolvedTimestampSeconds { get => this.Tag == DissolveStateTag.WhenDissolvedTimestampSeconds ? (ulong)this.Value! : default; set => (this.Tag, this.Value) = (DissolveStateTag.WhenDissolvedTimestampSeconds, value); } + + public DissolveState(DissolveStateTag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected DissolveState() + { + } + } + + public enum DissolveStateTag + { + DissolveDelaySeconds, + WhenDissolvedTimestampSeconds + } +} + +Type File: 'ExecuteNnsFunction' + +using System.Collections.Generic; + +namespace Test.Models +{ + public class ExecuteNnsFunction + { + public int nns_function { get; set; } + + public List payload { get; set; } + + public ExecuteNnsFunction(int nnsFunction, List payload) + { + this.nns_function = nnsFunction; + this.payload = payload; + } + + public ExecuteNnsFunction() + { + } + } +} + +Type File: 'Follow' + +using System.Collections.Generic; +using Test.Models; + +namespace Test.Models +{ + public class Follow + { + public int topic { get; set; } + + public List followees { get; set; } + + public Follow(int topic, List followees) + { + this.topic = topic; + this.followees = followees; + } + + public Follow() + { + } + } +} + +Type File: 'Followees' + +using System.Collections.Generic; +using Test.Models; + +namespace Test.Models +{ + public class Followees + { + public List followees { get; set; } + + public Followees(List followees) + { + this.followees = followees; + } + + public Followees() + { + } + } +} + +Type File: 'Governance' + +using System.Collections.Generic; +using Test.Models; +using EdjCase.ICP.Candid.Models; + +namespace Test.Models +{ + public class Governance + { + public Dictionary default_followees { get; set; } + + public ulong wait_for_quiet_threshold_seconds { get; set; } + + public OptionalValue metrics { get; set; } + + public List node_providers { get; set; } + + public OptionalValue economics { get; set; } + + public OptionalValue latest_reward_event { get; set; } + + public List to_claim_transfers { get; set; } + + public ulong short_voting_period_seconds { get; set; } + + public Dictionary proposals { get; set; } + + public Dictionary in_flight_commands { get; set; } + + public Dictionary neurons { get; set; } + + public ulong genesis_timestamp_seconds { get; set; } + + public Governance(Dictionary defaultFollowees, ulong waitForQuietThresholdSeconds, OptionalValue metrics, List nodeProviders, OptionalValue economics, OptionalValue latestRewardEvent, List toClaimTransfers, ulong shortVotingPeriodSeconds, Dictionary proposals, Dictionary inFlightCommands, Dictionary neurons, ulong genesisTimestampSeconds) + { + this.default_followees = defaultFollowees; + this.wait_for_quiet_threshold_seconds = waitForQuietThresholdSeconds; + this.metrics = metrics; + this.node_providers = nodeProviders; + this.economics = economics; + this.latest_reward_event = latestRewardEvent; + this.to_claim_transfers = toClaimTransfers; + this.short_voting_period_seconds = shortVotingPeriodSeconds; + this.proposals = proposals; + this.in_flight_commands = inFlightCommands; + this.neurons = neurons; + this.genesis_timestamp_seconds = genesisTimestampSeconds; + } + + public Governance() + { + } + } +} + +Type File: 'GovernanceCachedMetrics' + +using System.Collections.Generic; + +namespace Test.Models +{ + public class GovernanceCachedMetrics + { + public Dictionary not_dissolving_neurons_e8s_buckets { get; set; } + + public ulong garbage_collectable_neurons_count { get; set; } + + public ulong neurons_with_invalid_stake_count { get; set; } + + public Dictionary not_dissolving_neurons_count_buckets { get; set; } + + public ulong total_supply_icp { get; set; } + + public ulong neurons_with_less_than_6_months_dissolve_delay_count { get; set; } + + public ulong dissolved_neurons_count { get; set; } + + public ulong total_staked_e8s { get; set; } + + public ulong not_dissolving_neurons_count { get; set; } + + public ulong dissolved_neurons_e8s { get; set; } + + public ulong neurons_with_less_than_6_months_dissolve_delay_e8s { get; set; } + + public Dictionary dissolving_neurons_count_buckets { get; set; } + + public ulong dissolving_neurons_count { get; set; } + + public Dictionary dissolving_neurons_e8s_buckets { get; set; } + + public ulong community_fund_total_staked_e8s { get; set; } + + public ulong timestamp_seconds { get; set; } + + public GovernanceCachedMetrics(Dictionary notDissolvingNeuronsE8sBuckets, ulong garbageCollectableNeuronsCount, ulong neuronsWithInvalidStakeCount, Dictionary notDissolvingNeuronsCountBuckets, ulong totalSupplyIcp, ulong neuronsWithLessThan6MonthsDissolveDelayCount, ulong dissolvedNeuronsCount, ulong totalStakedE8s, ulong notDissolvingNeuronsCount, ulong dissolvedNeuronsE8s, ulong neuronsWithLessThan6MonthsDissolveDelayE8s, Dictionary dissolvingNeuronsCountBuckets, ulong dissolvingNeuronsCount, Dictionary dissolvingNeuronsE8sBuckets, ulong communityFundTotalStakedE8s, ulong timestampSeconds) + { + this.not_dissolving_neurons_e8s_buckets = notDissolvingNeuronsE8sBuckets; + this.garbage_collectable_neurons_count = garbageCollectableNeuronsCount; + this.neurons_with_invalid_stake_count = neuronsWithInvalidStakeCount; + this.not_dissolving_neurons_count_buckets = notDissolvingNeuronsCountBuckets; + this.total_supply_icp = totalSupplyIcp; + this.neurons_with_less_than_6_months_dissolve_delay_count = neuronsWithLessThan6MonthsDissolveDelayCount; + this.dissolved_neurons_count = dissolvedNeuronsCount; + this.total_staked_e8s = totalStakedE8s; + this.not_dissolving_neurons_count = notDissolvingNeuronsCount; + this.dissolved_neurons_e8s = dissolvedNeuronsE8s; + this.neurons_with_less_than_6_months_dissolve_delay_e8s = neuronsWithLessThan6MonthsDissolveDelayE8s; + this.dissolving_neurons_count_buckets = dissolvingNeuronsCountBuckets; + this.dissolving_neurons_count = dissolvingNeuronsCount; + this.dissolving_neurons_e8s_buckets = dissolvingNeuronsE8sBuckets; + this.community_fund_total_staked_e8s = communityFundTotalStakedE8s; + this.timestamp_seconds = timestampSeconds; + } + + public GovernanceCachedMetrics() + { + } + } +} + +Type File: 'GovernanceError' + +namespace Test.Models +{ + public class GovernanceError + { + public string error_message { get; set; } + + public int error_type { get; set; } + + public GovernanceError(string errorMessage, int errorType) + { + this.error_message = errorMessage; + this.error_type = errorType; + } + + public GovernanceError() + { + } + } +} + +Type File: 'IncreaseDissolveDelay' + +namespace Test.Models +{ + public class IncreaseDissolveDelay + { + public uint additional_dissolve_delay_seconds { get; set; } + + public IncreaseDissolveDelay(uint additionalDissolveDelaySeconds) + { + this.additional_dissolve_delay_seconds = additionalDissolveDelaySeconds; + } + + public IncreaseDissolveDelay() + { + } + } +} + +Type File: 'KnownNeuron' + +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class KnownNeuron + { + public OptionalValue id { get; set; } + + public OptionalValue known_neuron_data { get; set; } + + public KnownNeuron(OptionalValue id, OptionalValue knownNeuronData) + { + this.id = id; + this.known_neuron_data = knownNeuronData; + } + + public KnownNeuron() + { + } + } +} + +Type File: 'KnownNeuronData' + +using EdjCase.ICP.Candid.Models; + +namespace Test.Models +{ + public class KnownNeuronData + { + public string name { get; set; } + + public OptionalValue description { get; set; } + + public KnownNeuronData(string name, OptionalValue description) + { + this.name = name; + this.description = description; + } + + public KnownNeuronData() + { + } + } +} + +Type File: 'ListKnownNeuronsResponse' + +using System.Collections.Generic; +using Test.Models; + +namespace Test.Models +{ + public class ListKnownNeuronsResponse + { + public List known_neurons { get; set; } + + public ListKnownNeuronsResponse(List knownNeurons) + { + this.known_neurons = knownNeurons; + } + + public ListKnownNeuronsResponse() + { + } + } +} + +Type File: 'ListNeurons' + +using System.Collections.Generic; + +namespace Test.Models +{ + public class ListNeurons + { + public List neuron_ids { get; set; } + + public bool include_neurons_readable_by_caller { get; set; } + + public ListNeurons(List neuronIds, bool includeNeuronsReadableByCaller) + { + this.neuron_ids = neuronIds; + this.include_neurons_readable_by_caller = includeNeuronsReadableByCaller; + } + + public ListNeurons() + { + } + } +} + +Type File: 'ListNeuronsResponse' + +using System.Collections.Generic; +using Test.Models; + +namespace Test.Models +{ + public class ListNeuronsResponse + { + public Dictionary neuron_infos { get; set; } + + public List full_neurons { get; set; } + + public ListNeuronsResponse(Dictionary neuronInfos, List fullNeurons) + { + this.neuron_infos = neuronInfos; + this.full_neurons = fullNeurons; + } + + public ListNeuronsResponse() + { + } + } +} + +Type File: 'ListNodeProvidersResponse' + +using System.Collections.Generic; +using Test.Models; + +namespace Test.Models +{ + public class ListNodeProvidersResponse + { + public List node_providers { get; set; } + + public ListNodeProvidersResponse(List nodeProviders) + { + this.node_providers = nodeProviders; + } + + public ListNodeProvidersResponse() + { + } + } +} + +Type File: 'ListProposalInfo' + +using System.Collections.Generic; +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class ListProposalInfo + { + public List include_reward_status { get; set; } + + public OptionalValue before_proposal { get; set; } + + public uint limit { get; set; } + + public List exclude_topic { get; set; } + + public List include_status { get; set; } + + public ListProposalInfo(List includeRewardStatus, OptionalValue beforeProposal, uint limit, List excludeTopic, List includeStatus) + { + this.include_reward_status = includeRewardStatus; + this.before_proposal = beforeProposal; + this.limit = limit; + this.exclude_topic = excludeTopic; + this.include_status = includeStatus; + } + + public ListProposalInfo() + { + } + } +} + +Type File: 'ListProposalInfoResponse' + +using System.Collections.Generic; +using Test.Models; + +namespace Test.Models +{ + public class ListProposalInfoResponse + { + public List proposal_info { get; set; } + + public ListProposalInfoResponse(List proposalInfo) + { + this.proposal_info = proposalInfo; + } + + public ListProposalInfoResponse() + { + } + } +} + +Type File: 'MakeProposalResponse' + +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class MakeProposalResponse + { + public OptionalValue proposal_id { get; set; } + + public MakeProposalResponse(OptionalValue proposalId) + { + this.proposal_id = proposalId; + } + + public MakeProposalResponse() + { + } + } +} + +Type File: 'ManageNeuron' + +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class ManageNeuron + { + public OptionalValue id { get; set; } + + public OptionalValue command { get; set; } + + public OptionalValue neuron_id_or_subaccount { get; set; } + + public ManageNeuron(OptionalValue id, OptionalValue command, OptionalValue neuronIdOrSubaccount) + { + this.id = id; + this.command = command; + this.neuron_id_or_subaccount = neuronIdOrSubaccount; + } + + public ManageNeuron() + { + } + } +} + +Type File: 'ManageNeuronResponse' + +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class ManageNeuronResponse + { + public OptionalValue command { get; set; } + + public ManageNeuronResponse(OptionalValue command) + { + this.command = command; + } + + public ManageNeuronResponse() + { + } + } +} + +Type File: 'Merge' + +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class Merge + { + public OptionalValue source_neuron_id { get; set; } + + public Merge(OptionalValue sourceNeuronId) + { + this.source_neuron_id = sourceNeuronId; + } + + public Merge() + { + } + } +} + +Type File: 'MergeMaturity' + +namespace Test.Models +{ + public class MergeMaturity + { + public uint percentage_to_merge { get; set; } + + public MergeMaturity(uint percentageToMerge) + { + this.percentage_to_merge = percentageToMerge; + } + + public MergeMaturity() + { + } + } +} + +Type File: 'MergeMaturityResponse' + +namespace Test.Models +{ + public class MergeMaturityResponse + { + public ulong merged_maturity_e8s { get; set; } + + public ulong new_stake_e8s { get; set; } + + public MergeMaturityResponse(ulong mergedMaturityE8s, ulong newStakeE8s) + { + this.merged_maturity_e8s = mergedMaturityE8s; + this.new_stake_e8s = newStakeE8s; + } + + public MergeMaturityResponse() + { + } + } +} + +Type File: 'Motion' + +namespace Test.Models +{ + public class Motion + { + public string motion_text { get; set; } + + public Motion(string motionText) + { + this.motion_text = motionText; + } + + public Motion() + { + } + } +} + +Type File: 'NetworkEconomics' + +namespace Test.Models +{ + public class NetworkEconomics + { + public ulong neuron_minimum_stake_e8s { get; set; } + + public uint max_proposals_to_keep_per_topic { get; set; } + + public ulong neuron_management_fee_per_proposal_e8s { get; set; } + + public ulong reject_cost_e8s { get; set; } + + public ulong transaction_fee_e8s { get; set; } + + public ulong neuron_spawn_dissolve_delay_seconds { get; set; } + + public ulong minimum_icp_xdr_rate { get; set; } + + public ulong maximum_node_provider_rewards_e8s { get; set; } + + public NetworkEconomics(ulong neuronMinimumStakeE8s, uint maxProposalsToKeepPerTopic, ulong neuronManagementFeePerProposalE8s, ulong rejectCostE8s, ulong transactionFeeE8s, ulong neuronSpawnDissolveDelaySeconds, ulong minimumIcpXdrRate, ulong maximumNodeProviderRewardsE8s) + { + this.neuron_minimum_stake_e8s = neuronMinimumStakeE8s; + this.max_proposals_to_keep_per_topic = maxProposalsToKeepPerTopic; + this.neuron_management_fee_per_proposal_e8s = neuronManagementFeePerProposalE8s; + this.reject_cost_e8s = rejectCostE8s; + this.transaction_fee_e8s = transactionFeeE8s; + this.neuron_spawn_dissolve_delay_seconds = neuronSpawnDissolveDelaySeconds; + this.minimum_icp_xdr_rate = minimumIcpXdrRate; + this.maximum_node_provider_rewards_e8s = maximumNodeProviderRewardsE8s; + } + + public NetworkEconomics() + { + } + } +} + +Type File: 'Neuron' + +using EdjCase.ICP.Candid.Models; +using Test.Models; +using System.Collections.Generic; + +namespace Test.Models +{ + public class Neuron + { + public OptionalValue id { get; set; } + + public OptionalValue controller { get; set; } + + public List recent_ballots { get; set; } + + public bool kyc_verified { get; set; } + + public bool not_for_profit { get; set; } + + public ulong maturity_e8s_equivalent { get; set; } + + public ulong cached_neuron_stake_e8s { get; set; } + + public ulong created_timestamp_seconds { get; set; } + + public ulong aging_since_timestamp_seconds { get; set; } + + public List hot_keys { get; set; } + + public List account { get; set; } + + public OptionalValue joined_community_fund_timestamp_seconds { get; set; } + + public OptionalValue dissolve_state { get; set; } + + public Dictionary followees { get; set; } + + public ulong neuron_fees_e8s { get; set; } + + public OptionalValue transfer { get; set; } + + public OptionalValue known_neuron_data { get; set; } + + public Neuron(OptionalValue id, OptionalValue controller, List recentBallots, bool kycVerified, bool notForProfit, ulong maturityE8sEquivalent, ulong cachedNeuronStakeE8s, ulong createdTimestampSeconds, ulong agingSinceTimestampSeconds, List hotKeys, List account, OptionalValue joinedCommunityFundTimestampSeconds, OptionalValue dissolveState, Dictionary followees, ulong neuronFeesE8s, OptionalValue transfer, OptionalValue knownNeuronData) + { + this.id = id; + this.controller = controller; + this.recent_ballots = recentBallots; + this.kyc_verified = kycVerified; + this.not_for_profit = notForProfit; + this.maturity_e8s_equivalent = maturityE8sEquivalent; + this.cached_neuron_stake_e8s = cachedNeuronStakeE8s; + this.created_timestamp_seconds = createdTimestampSeconds; + this.aging_since_timestamp_seconds = agingSinceTimestampSeconds; + this.hot_keys = hotKeys; + this.account = account; + this.joined_community_fund_timestamp_seconds = joinedCommunityFundTimestampSeconds; + this.dissolve_state = dissolveState; + this.followees = followees; + this.neuron_fees_e8s = neuronFeesE8s; + this.transfer = transfer; + this.known_neuron_data = knownNeuronData; + } + + public Neuron() + { + } + } +} + +Type File: 'NeuronId' + +namespace Test.Models +{ + public class NeuronId + { + public ulong id { get; set; } + + public NeuronId(ulong id) + { + this.id = id; + } + + public NeuronId() + { + } + } +} + +Type File: 'NeuronIdOrSubaccount' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; +using System.Collections.Generic; + +namespace Test.Models +{ + [Variant()] + public class NeuronIdOrSubaccount + { + [VariantTagProperty()] + public NeuronIdOrSubaccountTag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public List Subaccount { get => this.Tag == NeuronIdOrSubaccountTag.Subaccount ? (List)this.Value! : default; set => (this.Tag, this.Value) = (NeuronIdOrSubaccountTag.Subaccount, value); } + + public NeuronId NeuronId { get => this.Tag == NeuronIdOrSubaccountTag.NeuronId ? (NeuronId)this.Value! : default; set => (this.Tag, this.Value) = (NeuronIdOrSubaccountTag.NeuronId, value); } + + public NeuronIdOrSubaccount(NeuronIdOrSubaccountTag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected NeuronIdOrSubaccount() + { + } + } + + public enum NeuronIdOrSubaccountTag + { + Subaccount, + NeuronId + } +} + +Type File: 'NeuronInFlightCommand' + +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class NeuronInFlightCommand + { + public OptionalValue command { get; set; } + + public ulong timestamp { get; set; } + + public NeuronInFlightCommand(OptionalValue command, ulong timestamp) + { + this.command = command; + this.timestamp = timestamp; + } + + public NeuronInFlightCommand() + { + } + } +} + +Type File: 'NeuronInfo' + +using System.Collections.Generic; +using Test.Models; +using EdjCase.ICP.Candid.Models; + +namespace Test.Models +{ + public class NeuronInfo + { + public ulong dissolve_delay_seconds { get; set; } + + public List recent_ballots { get; set; } + + public ulong created_timestamp_seconds { get; set; } + + public int state { get; set; } + + public ulong stake_e8s { get; set; } + + public OptionalValue joined_community_fund_timestamp_seconds { get; set; } + + public ulong retrieved_at_timestamp_seconds { get; set; } + + public OptionalValue known_neuron_data { get; set; } + + public ulong voting_power { get; set; } + + public ulong age_seconds { get; set; } + + public NeuronInfo(ulong dissolveDelaySeconds, List recentBallots, ulong createdTimestampSeconds, int state, ulong stakeE8s, OptionalValue joinedCommunityFundTimestampSeconds, ulong retrievedAtTimestampSeconds, OptionalValue knownNeuronData, ulong votingPower, ulong ageSeconds) + { + this.dissolve_delay_seconds = dissolveDelaySeconds; + this.recent_ballots = recentBallots; + this.created_timestamp_seconds = createdTimestampSeconds; + this.state = state; + this.stake_e8s = stakeE8s; + this.joined_community_fund_timestamp_seconds = joinedCommunityFundTimestampSeconds; + this.retrieved_at_timestamp_seconds = retrievedAtTimestampSeconds; + this.known_neuron_data = knownNeuronData; + this.voting_power = votingPower; + this.age_seconds = ageSeconds; + } + + public NeuronInfo() + { + } + } +} + +Type File: 'NeuronStakeTransfer' + +using System.Collections.Generic; +using EdjCase.ICP.Candid.Models; + +namespace Test.Models +{ + public class NeuronStakeTransfer + { + public List to_subaccount { get; set; } + + public ulong neuron_stake_e8s { get; set; } + + public OptionalValue from { get; set; } + + public ulong memo { get; set; } + + public List from_subaccount { get; set; } + + public ulong transfer_timestamp { get; set; } + + public ulong block_height { get; set; } + + public NeuronStakeTransfer(List toSubaccount, ulong neuronStakeE8s, OptionalValue from, ulong memo, List fromSubaccount, ulong transferTimestamp, ulong blockHeight) + { + this.to_subaccount = toSubaccount; + this.neuron_stake_e8s = neuronStakeE8s; + this.from = from; + this.memo = memo; + this.from_subaccount = fromSubaccount; + this.transfer_timestamp = transferTimestamp; + this.block_height = blockHeight; + } + + public NeuronStakeTransfer() + { + } + } +} + +Type File: 'NodeProvider' + +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class NodeProvider + { + public OptionalValue id { get; set; } + + public OptionalValue reward_account { get; set; } + + public NodeProvider(OptionalValue id, OptionalValue rewardAccount) + { + this.id = id; + this.reward_account = rewardAccount; + } + + public NodeProvider() + { + } + } +} + +Type File: 'Operation' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; + +namespace Test.Models +{ + [Variant()] + public class Operation + { + [VariantTagProperty()] + public OperationTag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public RemoveHotKey RemoveHotKey { get => this.Tag == OperationTag.RemoveHotKey ? (RemoveHotKey)this.Value! : default; set => (this.Tag, this.Value) = (OperationTag.RemoveHotKey, value); } + + public AddHotKey AddHotKey { get => this.Tag == OperationTag.AddHotKey ? (AddHotKey)this.Value! : default; set => (this.Tag, this.Value) = (OperationTag.AddHotKey, value); } + + public Operation.StopDissolvingInfo StopDissolving { get => this.Tag == OperationTag.StopDissolving ? (Operation.StopDissolvingInfo)this.Value! : default; set => (this.Tag, this.Value) = (OperationTag.StopDissolving, value); } + + public Operation.StartDissolvingInfo StartDissolving { get => this.Tag == OperationTag.StartDissolving ? (Operation.StartDissolvingInfo)this.Value! : default; set => (this.Tag, this.Value) = (OperationTag.StartDissolving, value); } + + public IncreaseDissolveDelay IncreaseDissolveDelay { get => this.Tag == OperationTag.IncreaseDissolveDelay ? (IncreaseDissolveDelay)this.Value! : default; set => (this.Tag, this.Value) = (OperationTag.IncreaseDissolveDelay, value); } + + public Operation.JoinCommunityFundInfo JoinCommunityFund { get => this.Tag == OperationTag.JoinCommunityFund ? (Operation.JoinCommunityFundInfo)this.Value! : default; set => (this.Tag, this.Value) = (OperationTag.JoinCommunityFund, value); } + + public SetDissolveTimestamp SetDissolveTimestamp { get => this.Tag == OperationTag.SetDissolveTimestamp ? (SetDissolveTimestamp)this.Value! : default; set => (this.Tag, this.Value) = (OperationTag.SetDissolveTimestamp, value); } + + public Operation(OperationTag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected Operation() + { + } + + public class StopDissolvingInfo + { + public StopDissolvingInfo() + { + } + } + + public class StartDissolvingInfo + { + public StartDissolvingInfo() + { + } + } + + public class JoinCommunityFundInfo + { + public JoinCommunityFundInfo() + { + } + } + } + + public enum OperationTag + { + RemoveHotKey, + AddHotKey, + StopDissolving, + StartDissolving, + IncreaseDissolveDelay, + JoinCommunityFund, + SetDissolveTimestamp + } +} + +Type File: 'Proposal' + +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class Proposal + { + public string url { get; set; } + + public OptionalValue title { get; set; } + + public OptionalValue action { get; set; } + + public string summary { get; set; } + + public Proposal(string url, OptionalValue title, OptionalValue action, string summary) + { + this.url = url; + this.title = title; + this.action = action; + this.summary = summary; + } + + public Proposal() + { + } + } +} + +Type File: 'ProposalData' + +using EdjCase.ICP.Candid.Models; +using Test.Models; +using System.Collections.Generic; + +namespace Test.Models +{ + public class ProposalData + { + public OptionalValue id { get; set; } + + public OptionalValue failure_reason { get; set; } + + public Dictionary ballots { get; set; } + + public ulong proposal_timestamp_seconds { get; set; } + + public ulong reward_event_round { get; set; } + + public ulong failed_timestamp_seconds { get; set; } + + public ulong reject_cost_e8s { get; set; } + + public OptionalValue latest_tally { get; set; } + + public ulong decided_timestamp_seconds { get; set; } + + public OptionalValue proposal { get; set; } + + public OptionalValue proposer { get; set; } + + public OptionalValue wait_for_quiet_state { get; set; } + + public ulong executed_timestamp_seconds { get; set; } + + public ProposalData(OptionalValue id, OptionalValue failureReason, Dictionary ballots, ulong proposalTimestampSeconds, ulong rewardEventRound, ulong failedTimestampSeconds, ulong rejectCostE8s, OptionalValue latestTally, ulong decidedTimestampSeconds, OptionalValue proposal, OptionalValue proposer, OptionalValue waitForQuietState, ulong executedTimestampSeconds) + { + this.id = id; + this.failure_reason = failureReason; + this.ballots = ballots; + this.proposal_timestamp_seconds = proposalTimestampSeconds; + this.reward_event_round = rewardEventRound; + this.failed_timestamp_seconds = failedTimestampSeconds; + this.reject_cost_e8s = rejectCostE8s; + this.latest_tally = latestTally; + this.decided_timestamp_seconds = decidedTimestampSeconds; + this.proposal = proposal; + this.proposer = proposer; + this.wait_for_quiet_state = waitForQuietState; + this.executed_timestamp_seconds = executedTimestampSeconds; + } + + public ProposalData() + { + } + } +} + +Type File: 'ProposalInfo' + +using EdjCase.ICP.Candid.Models; +using Test.Models; +using System.Collections.Generic; + +namespace Test.Models +{ + public class ProposalInfo + { + public OptionalValue id { get; set; } + + public int status { get; set; } + + public int topic { get; set; } + + public OptionalValue failure_reason { get; set; } + + public Dictionary ballots { get; set; } + + public ulong proposal_timestamp_seconds { get; set; } + + public ulong reward_event_round { get; set; } + + public OptionalValue deadline_timestamp_seconds { get; set; } + + public ulong failed_timestamp_seconds { get; set; } + + public ulong reject_cost_e8s { get; set; } + + public OptionalValue latest_tally { get; set; } + + public int reward_status { get; set; } + + public ulong decided_timestamp_seconds { get; set; } + + public OptionalValue proposal { get; set; } + + public OptionalValue proposer { get; set; } + + public ulong executed_timestamp_seconds { get; set; } + + public ProposalInfo(OptionalValue id, int status, int topic, OptionalValue failureReason, Dictionary ballots, ulong proposalTimestampSeconds, ulong rewardEventRound, OptionalValue deadlineTimestampSeconds, ulong failedTimestampSeconds, ulong rejectCostE8s, OptionalValue latestTally, int rewardStatus, ulong decidedTimestampSeconds, OptionalValue proposal, OptionalValue proposer, ulong executedTimestampSeconds) + { + this.id = id; + this.status = status; + this.topic = topic; + this.failure_reason = failureReason; + this.ballots = ballots; + this.proposal_timestamp_seconds = proposalTimestampSeconds; + this.reward_event_round = rewardEventRound; + this.deadline_timestamp_seconds = deadlineTimestampSeconds; + this.failed_timestamp_seconds = failedTimestampSeconds; + this.reject_cost_e8s = rejectCostE8s; + this.latest_tally = latestTally; + this.reward_status = rewardStatus; + this.decided_timestamp_seconds = decidedTimestampSeconds; + this.proposal = proposal; + this.proposer = proposer; + this.executed_timestamp_seconds = executedTimestampSeconds; + } + + public ProposalInfo() + { + } + } +} + +Type File: 'RegisterVote' + +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class RegisterVote + { + public int vote { get; set; } + + public OptionalValue proposal { get; set; } + + public RegisterVote(int vote, OptionalValue proposal) + { + this.vote = vote; + this.proposal = proposal; + } + + public RegisterVote() + { + } + } +} + +Type File: 'RemoveHotKey' + +using EdjCase.ICP.Candid.Models; + +namespace Test.Models +{ + public class RemoveHotKey + { + public OptionalValue hot_key_to_remove { get; set; } + + public RemoveHotKey(OptionalValue hotKeyToRemove) + { + this.hot_key_to_remove = hotKeyToRemove; + } + + public RemoveHotKey() + { + } + } +} + +Type File: 'Result' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; + +namespace Test.Models +{ + [Variant()] + public class Result + { + [VariantTagProperty()] + public ResultTag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public GovernanceError Err { get => this.Tag == ResultTag.Err ? (GovernanceError)this.Value! : default; set => (this.Tag, this.Value) = (ResultTag.Err, value); } + + public Result(ResultTag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected Result() + { + } + } + + public enum ResultTag + { + Ok, + Err + } +} + +Type File: 'Result_1' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; + +namespace Test.Models +{ + [Variant()] + public class Result_1 + { + [VariantTagProperty()] + public Result_1Tag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public GovernanceError Error { get => this.Tag == Result_1Tag.Error ? (GovernanceError)this.Value! : default; set => (this.Tag, this.Value) = (Result_1Tag.Error, value); } + + public NeuronId NeuronId { get => this.Tag == Result_1Tag.NeuronId ? (NeuronId)this.Value! : default; set => (this.Tag, this.Value) = (Result_1Tag.NeuronId, value); } + + public Result_1(Result_1Tag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected Result_1() + { + } + } + + public enum Result_1Tag + { + Error, + NeuronId + } +} + +Type File: 'Result_2' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; + +namespace Test.Models +{ + [Variant()] + public class Result_2 + { + [VariantTagProperty()] + public Result_2Tag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public Neuron Ok { get => this.Tag == Result_2Tag.Ok ? (Neuron)this.Value! : default; set => (this.Tag, this.Value) = (Result_2Tag.Ok, value); } + + public GovernanceError Err { get => this.Tag == Result_2Tag.Err ? (GovernanceError)this.Value! : default; set => (this.Tag, this.Value) = (Result_2Tag.Err, value); } + + public Result_2(Result_2Tag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected Result_2() + { + } + } + + public enum Result_2Tag + { + Ok, + Err + } +} + +Type File: 'Result_3' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; + +namespace Test.Models +{ + [Variant()] + public class Result_3 + { + [VariantTagProperty()] + public Result_3Tag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public RewardNodeProviders Ok { get => this.Tag == Result_3Tag.Ok ? (RewardNodeProviders)this.Value! : default; set => (this.Tag, this.Value) = (Result_3Tag.Ok, value); } + + public GovernanceError Err { get => this.Tag == Result_3Tag.Err ? (GovernanceError)this.Value! : default; set => (this.Tag, this.Value) = (Result_3Tag.Err, value); } + + public Result_3(Result_3Tag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected Result_3() + { + } + } + + public enum Result_3Tag + { + Ok, + Err + } +} + +Type File: 'Result_4' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; + +namespace Test.Models +{ + [Variant()] + public class Result_4 + { + [VariantTagProperty()] + public Result_4Tag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public NeuronInfo Ok { get => this.Tag == Result_4Tag.Ok ? (NeuronInfo)this.Value! : default; set => (this.Tag, this.Value) = (Result_4Tag.Ok, value); } + + public GovernanceError Err { get => this.Tag == Result_4Tag.Err ? (GovernanceError)this.Value! : default; set => (this.Tag, this.Value) = (Result_4Tag.Err, value); } + + public Result_4(Result_4Tag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected Result_4() + { + } + } + + public enum Result_4Tag + { + Ok, + Err + } +} + +Type File: 'Result_5' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; + +namespace Test.Models +{ + [Variant()] + public class Result_5 + { + [VariantTagProperty()] + public Result_5Tag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public NodeProvider Ok { get => this.Tag == Result_5Tag.Ok ? (NodeProvider)this.Value! : default; set => (this.Tag, this.Value) = (Result_5Tag.Ok, value); } + + public GovernanceError Err { get => this.Tag == Result_5Tag.Err ? (GovernanceError)this.Value! : default; set => (this.Tag, this.Value) = (Result_5Tag.Err, value); } + + public Result_5(Result_5Tag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected Result_5() + { + } + } + + public enum Result_5Tag + { + Ok, + Err + } +} + +Type File: 'RewardEvent' + +using System.Collections.Generic; +using Test.Models; + +namespace Test.Models +{ + public class RewardEvent + { + public ulong day_after_genesis { get; set; } + + public ulong actual_timestamp_seconds { get; set; } + + public ulong distributed_e8s_equivalent { get; set; } + + public List settled_proposals { get; set; } + + public RewardEvent(ulong dayAfterGenesis, ulong actualTimestampSeconds, ulong distributedE8sEquivalent, List settledProposals) + { + this.day_after_genesis = dayAfterGenesis; + this.actual_timestamp_seconds = actualTimestampSeconds; + this.distributed_e8s_equivalent = distributedE8sEquivalent; + this.settled_proposals = settledProposals; + } + + public RewardEvent() + { + } + } +} + +Type File: 'RewardMode' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; + +namespace Test.Models +{ + [Variant()] + public class RewardMode + { + [VariantTagProperty()] + public RewardModeTag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public RewardToNeuron RewardToNeuron { get => this.Tag == RewardModeTag.RewardToNeuron ? (RewardToNeuron)this.Value! : default; set => (this.Tag, this.Value) = (RewardModeTag.RewardToNeuron, value); } + + public RewardToAccount RewardToAccount { get => this.Tag == RewardModeTag.RewardToAccount ? (RewardToAccount)this.Value! : default; set => (this.Tag, this.Value) = (RewardModeTag.RewardToAccount, value); } + + public RewardMode(RewardModeTag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected RewardMode() + { + } + } + + public enum RewardModeTag + { + RewardToNeuron, + RewardToAccount + } +} + +Type File: 'RewardNodeProvider' + +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class RewardNodeProvider + { + public OptionalValue node_provider { get; set; } + + public OptionalValue reward_mode { get; set; } + + public ulong amount_e8s { get; set; } + + public RewardNodeProvider(OptionalValue nodeProvider, OptionalValue rewardMode, ulong amountE8s) + { + this.node_provider = nodeProvider; + this.reward_mode = rewardMode; + this.amount_e8s = amountE8s; + } + + public RewardNodeProvider() + { + } + } +} + +Type File: 'RewardNodeProviders' + +using EdjCase.ICP.Candid.Models; +using System.Collections.Generic; +using Test.Models; + +namespace Test.Models +{ + public class RewardNodeProviders + { + public OptionalValue use_registry_derived_rewards { get; set; } + + public List rewards { get; set; } + + public RewardNodeProviders(OptionalValue useRegistryDerivedRewards, List rewards) + { + this.use_registry_derived_rewards = useRegistryDerivedRewards; + this.rewards = rewards; + } + + public RewardNodeProviders() + { + } + } +} + +Type File: 'RewardToAccount' + +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class RewardToAccount + { + public OptionalValue to_account { get; set; } + + public RewardToAccount(OptionalValue toAccount) + { + this.to_account = toAccount; + } + + public RewardToAccount() + { + } + } +} + +Type File: 'RewardToNeuron' + +namespace Test.Models +{ + public class RewardToNeuron + { + public ulong dissolve_delay_seconds { get; set; } + + public RewardToNeuron(ulong dissolveDelaySeconds) + { + this.dissolve_delay_seconds = dissolveDelaySeconds; + } + + public RewardToNeuron() + { + } + } +} + +Type File: 'SetDefaultFollowees' + +using System.Collections.Generic; +using Test.Models; + +namespace Test.Models +{ + public class SetDefaultFollowees + { + public Dictionary default_followees { get; set; } + + public SetDefaultFollowees(Dictionary defaultFollowees) + { + this.default_followees = defaultFollowees; + } + + public SetDefaultFollowees() + { + } + } +} + +Type File: 'SetDissolveTimestamp' + +namespace Test.Models +{ + public class SetDissolveTimestamp + { + public ulong dissolve_timestamp_seconds { get; set; } + + public SetDissolveTimestamp(ulong dissolveTimestampSeconds) + { + this.dissolve_timestamp_seconds = dissolveTimestampSeconds; + } + + public SetDissolveTimestamp() + { + } + } +} + +Type File: 'Spawn' + +using EdjCase.ICP.Candid.Models; + +namespace Test.Models +{ + public class Spawn + { + public OptionalValue percentage_to_spawn { get; set; } + + public OptionalValue new_controller { get; set; } + + public OptionalValue nonce { get; set; } + + public Spawn(OptionalValue percentageToSpawn, OptionalValue newController, OptionalValue nonce) + { + this.percentage_to_spawn = percentageToSpawn; + this.new_controller = newController; + this.nonce = nonce; + } + + public Spawn() + { + } + } +} + +Type File: 'SpawnResponse' + +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class SpawnResponse + { + public OptionalValue created_neuron_id { get; set; } + + public SpawnResponse(OptionalValue createdNeuronId) + { + this.created_neuron_id = createdNeuronId; + } + + public SpawnResponse() + { + } + } +} + +Type File: 'Split' + +namespace Test.Models +{ + public class Split + { + public ulong amount_e8s { get; set; } + + public Split(ulong amountE8s) + { + this.amount_e8s = amountE8s; + } + + public Split() + { + } + } +} + +Type File: 'Tally' + +namespace Test.Models +{ + public class Tally + { + public ulong no { get; set; } + + public ulong yes { get; set; } + + public ulong total { get; set; } + + public ulong timestamp_seconds { get; set; } + + public Tally(ulong no, ulong yes, ulong total, ulong timestampSeconds) + { + this.no = no; + this.yes = yes; + this.total = total; + this.timestamp_seconds = timestampSeconds; + } + + public Tally() + { + } + } +} + +Type File: 'UpdateNodeProvider' + +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class UpdateNodeProvider + { + public OptionalValue reward_account { get; set; } + + public UpdateNodeProvider(OptionalValue rewardAccount) + { + this.reward_account = rewardAccount; + } + + public UpdateNodeProvider() + { + } + } +} + +Type File: 'WaitForQuietState' + +namespace Test.Models +{ + public class WaitForQuietState + { + public ulong current_deadline_timestamp_seconds { get; set; } + + public WaitForQuietState(ulong currentDeadlineTimestampSeconds) + { + this.current_deadline_timestamp_seconds = currentDeadlineTimestampSeconds; + } + + public WaitForQuietState() + { + } + } +} diff --git a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_True_KeepCandidCase_False.snap b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False.snap similarity index 95% rename from test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_True_KeepCandidCase_False.snap rename to test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False.snap index 25c8b48e..67007143 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_True_KeepCandidCase_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False.snap @@ -210,7 +210,7 @@ using System; namespace Test.Models { - [Variant(typeof(ActionTag))] + [Variant()] public class Action { [VariantTagProperty()] @@ -350,25 +350,15 @@ namespace Test.Models public enum ActionTag { - [VariantOptionType(typeof(KnownNeuron))] RegisterKnownNeuron, - [VariantOptionType(typeof(ManageNeuron))] ManageNeuron, - [VariantOptionType(typeof(ExecuteNnsFunction))] ExecuteNnsFunction, - [VariantOptionType(typeof(RewardNodeProvider))] RewardNodeProvider, - [VariantOptionType(typeof(SetDefaultFollowees))] SetDefaultFollowees, - [VariantOptionType(typeof(RewardNodeProviders))] RewardNodeProviders, - [VariantOptionType(typeof(NetworkEconomics))] ManageNetworkEconomics, - [VariantOptionType(typeof(ApproveGenesisKyc))] ApproveGenesisKyc, - [VariantOptionType(typeof(AddOrRemoveNodeProvider))] AddOrRemoveNodeProvider, - [VariantOptionType(typeof(Motion))] Motion } } @@ -528,7 +518,7 @@ using System; namespace Test.Models { - [Variant(typeof(ByTag))] + [Variant()] public class By { [VariantTagProperty()] @@ -598,11 +588,8 @@ namespace Test.Models public enum ByTag { - [VariantOptionType(typeof(By.NeuronIdOrSubaccountInfo))] NeuronIdOrSubaccount, - [VariantOptionType(typeof(ClaimOrRefreshNeuronFromAccount))] MemoAndController, - [VariantOptionType(typeof(ulong))] Memo } } @@ -615,7 +602,7 @@ using System; namespace Test.Models { - [Variant(typeof(ChangeTag))] + [Variant()] public class Change { [VariantTagProperty()] @@ -667,9 +654,7 @@ namespace Test.Models public enum ChangeTag { - [VariantOptionType(typeof(NodeProvider))] ToRemove, - [VariantOptionType(typeof(NodeProvider))] ToAdd } } @@ -781,7 +766,7 @@ using System; namespace Test.Models { - [Variant(typeof(CommandTag))] + [Variant()] public class Command { [VariantTagProperty()] @@ -932,27 +917,16 @@ namespace Test.Models public enum CommandTag { - [VariantOptionType(typeof(Spawn))] Spawn, - [VariantOptionType(typeof(Split))] Split, - [VariantOptionType(typeof(Follow))] Follow, - [VariantOptionType(typeof(ClaimOrRefresh))] ClaimOrRefresh, - [VariantOptionType(typeof(Configure))] Configure, - [VariantOptionType(typeof(RegisterVote))] RegisterVote, - [VariantOptionType(typeof(Merge))] Merge, - [VariantOptionType(typeof(DisburseToNeuron))] DisburseToNeuron, - [VariantOptionType(typeof(Proposal))] MakeProposal, - [VariantOptionType(typeof(MergeMaturity))] MergeMaturity, - [VariantOptionType(typeof(Disburse))] Disburse } } @@ -965,7 +939,7 @@ using System; namespace Test.Models { - [Variant(typeof(Command1Tag))] + [Variant()] public class Command1 { [VariantTagProperty()] @@ -1155,29 +1129,17 @@ namespace Test.Models public enum Command1Tag { - [VariantOptionType(typeof(GovernanceError))] Error, - [VariantOptionType(typeof(SpawnResponse))] Spawn, - [VariantOptionType(typeof(SpawnResponse))] Split, - [VariantOptionType(typeof(Command1.FollowInfo))] Follow, - [VariantOptionType(typeof(ClaimOrRefreshResponse))] ClaimOrRefresh, - [VariantOptionType(typeof(Command1.ConfigureInfo))] Configure, - [VariantOptionType(typeof(Command1.RegisterVoteInfo))] RegisterVote, - [VariantOptionType(typeof(Command1.MergeInfo))] Merge, - [VariantOptionType(typeof(SpawnResponse))] DisburseToNeuron, - [VariantOptionType(typeof(MakeProposalResponse))] MakeProposal, - [VariantOptionType(typeof(MergeMaturityResponse))] MergeMaturity, - [VariantOptionType(typeof(DisburseResponse))] Disburse } } @@ -1190,7 +1152,7 @@ using System; namespace Test.Models { - [Variant(typeof(Command2Tag))] + [Variant()] public class Command2 { [VariantTagProperty()] @@ -1308,21 +1270,13 @@ namespace Test.Models public enum Command2Tag { - [VariantOptionType(typeof(Spawn))] Spawn, - [VariantOptionType(typeof(Split))] Split, - [VariantOptionType(typeof(Configure))] Configure, - [VariantOptionType(typeof(Merge))] Merge, - [VariantOptionType(typeof(DisburseToNeuron))] DisburseToNeuron, - [VariantOptionType(typeof(ClaimOrRefresh))] ClaimOrRefreshNeuron, - [VariantOptionType(typeof(MergeMaturity))] MergeMaturity, - [VariantOptionType(typeof(Disburse))] Disburse } } @@ -1448,7 +1402,7 @@ using System; namespace Test.Models { - [Variant(typeof(DissolveStateTag))] + [Variant()] public class DissolveState { [VariantTagProperty()] @@ -1500,9 +1454,7 @@ namespace Test.Models public enum DissolveStateTag { - [VariantOptionType(typeof(ulong))] DissolveDelaySeconds, - [VariantOptionType(typeof(ulong))] WhenDissolvedTimestampSeconds } } @@ -2353,7 +2305,7 @@ using System; namespace Test.Models { - [Variant(typeof(NeuronIdOrSubaccountTag))] + [Variant()] public class NeuronIdOrSubaccount { [VariantTagProperty()] @@ -2405,9 +2357,7 @@ namespace Test.Models public enum NeuronIdOrSubaccountTag { - [VariantOptionType(typeof(List))] Subaccount, - [VariantOptionType(typeof(NeuronId))] NeuronId } } @@ -2585,7 +2535,7 @@ using System; namespace Test.Models { - [Variant(typeof(OperationTag))] + [Variant()] public class Operation { [VariantTagProperty()] @@ -2713,19 +2663,12 @@ namespace Test.Models public enum OperationTag { - [VariantOptionType(typeof(RemoveHotKey))] RemoveHotKey, - [VariantOptionType(typeof(AddHotKey))] AddHotKey, - [VariantOptionType(typeof(Operation.StopDissolvingInfo))] StopDissolving, - [VariantOptionType(typeof(Operation.StartDissolvingInfo))] StartDissolving, - [VariantOptionType(typeof(IncreaseDissolveDelay))] IncreaseDissolveDelay, - [VariantOptionType(typeof(Operation.JoinCommunityFundInfo))] JoinCommunityFund, - [VariantOptionType(typeof(SetDissolveTimestamp))] SetDissolveTimestamp } } @@ -2983,7 +2926,7 @@ using System; namespace Test.Models { - [Variant(typeof(ResultTag))] + [Variant()] public class Result { [VariantTagProperty()] @@ -3030,7 +2973,6 @@ namespace Test.Models public enum ResultTag { Ok, - [VariantOptionType(typeof(GovernanceError))] Err } } @@ -3043,7 +2985,7 @@ using System; namespace Test.Models { - [Variant(typeof(Result1Tag))] + [Variant()] public class Result1 { [VariantTagProperty()] @@ -3095,9 +3037,7 @@ namespace Test.Models public enum Result1Tag { - [VariantOptionType(typeof(GovernanceError))] Error, - [VariantOptionType(typeof(NeuronId))] NeuronId } } @@ -3110,7 +3050,7 @@ using System; namespace Test.Models { - [Variant(typeof(Result2Tag))] + [Variant()] public class Result2 { [VariantTagProperty()] @@ -3162,9 +3102,7 @@ namespace Test.Models public enum Result2Tag { - [VariantOptionType(typeof(Neuron))] Ok, - [VariantOptionType(typeof(GovernanceError))] Err } } @@ -3177,7 +3115,7 @@ using System; namespace Test.Models { - [Variant(typeof(Result3Tag))] + [Variant()] public class Result3 { [VariantTagProperty()] @@ -3229,9 +3167,7 @@ namespace Test.Models public enum Result3Tag { - [VariantOptionType(typeof(RewardNodeProviders))] Ok, - [VariantOptionType(typeof(GovernanceError))] Err } } @@ -3244,7 +3180,7 @@ using System; namespace Test.Models { - [Variant(typeof(Result4Tag))] + [Variant()] public class Result4 { [VariantTagProperty()] @@ -3296,9 +3232,7 @@ namespace Test.Models public enum Result4Tag { - [VariantOptionType(typeof(NeuronInfo))] Ok, - [VariantOptionType(typeof(GovernanceError))] Err } } @@ -3311,7 +3245,7 @@ using System; namespace Test.Models { - [Variant(typeof(Result5Tag))] + [Variant()] public class Result5 { [VariantTagProperty()] @@ -3363,9 +3297,7 @@ namespace Test.Models public enum Result5Tag { - [VariantOptionType(typeof(NodeProvider))] Ok, - [VariantOptionType(typeof(GovernanceError))] Err } } @@ -3414,7 +3346,7 @@ using System; namespace Test.Models { - [Variant(typeof(RewardModeTag))] + [Variant()] public class RewardMode { [VariantTagProperty()] @@ -3466,9 +3398,7 @@ namespace Test.Models public enum RewardModeTag { - [VariantOptionType(typeof(RewardToNeuron))] RewardToNeuron, - [VariantOptionType(typeof(RewardToAccount))] RewardToAccount } } diff --git a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True.snap b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True.snap new file mode 100644 index 00000000..db4d8c4b --- /dev/null +++ b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True.snap @@ -0,0 +1,2935 @@ +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 +{ + public class GovernanceApiClient + { + public IAgent Agent { get; } + + public Principal CanisterId { get; } + + public CandidConverter? Converter { get; } + + public GovernanceApiClient(IAgent agent, Principal canisterId, CandidConverter? converter = default) + { + this.Agent = agent; + this.CanisterId = canisterId; + this.Converter = converter; + } + + public async Task ClaimGtcNeurons(Principal arg0, List arg1) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0), CandidTypedValue.FromObject(arg1)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "claim_gtc_neurons", arg); + return reply.ToObjects(this.Converter); + } + + public async Task ClaimOrRefreshNeuronFromAccount(Models.ClaimOrRefreshNeuronFromAccount arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "claim_or_refresh_neuron_from_account", arg); + return reply.ToObjects(this.Converter); + } + + public async Task GetBuildMetadata() + { + CandidArg arg = CandidArg.FromCandid(); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_build_metadata", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + + public async Task GetFullNeuron(ulong arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + + public async Task GetFullNeuronByIdOrSubaccount(Models.NeuronIdOrSubaccount arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron_by_id_or_subaccount", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + + public async Task GetMonthlyNodeProviderRewards() + { + CandidArg arg = CandidArg.FromCandid(); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "get_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(); + 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(); + return reply.ToObjects>(this.Converter); + } + + public async Task GetNeuronInfo(ulong arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + + public async Task GetNeuronInfoByIdOrSubaccount(Models.NeuronIdOrSubaccount arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info_by_id_or_subaccount", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + + public async Task GetNodeProviderByCaller(NullValue arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_node_provider_by_caller", arg); + CandidArg reply = response.ThrowOrGetReply(); + 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(); + return reply.ToObjects>(this.Converter); + } + + public async Task> GetProposalInfo(ulong arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_proposal_info", arg); + CandidArg reply = response.ThrowOrGetReply(); + 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(); + return reply.ToObjects(this.Converter); + } + + public async Task ListNeurons(Models.ListNeurons arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_neurons", arg); + CandidArg reply = response.ThrowOrGetReply(); + 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(); + return reply.ToObjects(this.Converter); + } + + public async Task ListProposals(Models.ListProposalInfo arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_proposals", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + + public async Task ManageNeuron(Models.ManageNeuron arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "manage_neuron", arg); + return reply.ToObjects(this.Converter); + } + + public async Task TransferGtcNeuron(Models.NeuronId arg0, Models.NeuronId arg1) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0), CandidTypedValue.FromObject(arg1)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "transfer_gtc_neuron", arg); + return reply.ToObjects(this.Converter); + } + + public async Task UpdateNodeProvider(Models.UpdateNodeProvider arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "update_node_provider", arg); + return reply.ToObjects(this.Converter); + } + } +} + +Type File: 'AccountIdentifier' + +using EdjCase.ICP.Candid.Mapping; +using System.Collections.Generic; + +namespace Test.Models +{ + public class AccountIdentifier + { + [CandidName("hash")] + public List Hash { get; set; } + + public AccountIdentifier(List hash) + { + this.Hash = hash; + } + + public AccountIdentifier() + { + } + } +} + +Type File: 'Action' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; + +namespace Test.Models +{ + [Variant()] + public class Action + { + [VariantTagProperty()] + public ActionTag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public KnownNeuron? RegisterKnownNeuron { get => this.Tag == ActionTag.RegisterKnownNeuron ? (KnownNeuron)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.RegisterKnownNeuron, value); } + + public ManageNeuron? ManageNeuron { get => this.Tag == ActionTag.ManageNeuron ? (ManageNeuron)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.ManageNeuron, value); } + + public ExecuteNnsFunction? ExecuteNnsFunction { get => this.Tag == ActionTag.ExecuteNnsFunction ? (ExecuteNnsFunction)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.ExecuteNnsFunction, value); } + + public RewardNodeProvider? RewardNodeProvider { get => this.Tag == ActionTag.RewardNodeProvider ? (RewardNodeProvider)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.RewardNodeProvider, value); } + + public SetDefaultFollowees? SetDefaultFollowees { get => this.Tag == ActionTag.SetDefaultFollowees ? (SetDefaultFollowees)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.SetDefaultFollowees, value); } + + public RewardNodeProviders? RewardNodeProviders { get => this.Tag == ActionTag.RewardNodeProviders ? (RewardNodeProviders)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.RewardNodeProviders, value); } + + public NetworkEconomics? ManageNetworkEconomics { get => this.Tag == ActionTag.ManageNetworkEconomics ? (NetworkEconomics)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.ManageNetworkEconomics, value); } + + public ApproveGenesisKyc? ApproveGenesisKyc { get => this.Tag == ActionTag.ApproveGenesisKyc ? (ApproveGenesisKyc)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.ApproveGenesisKyc, value); } + + public AddOrRemoveNodeProvider? AddOrRemoveNodeProvider { get => this.Tag == ActionTag.AddOrRemoveNodeProvider ? (AddOrRemoveNodeProvider)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.AddOrRemoveNodeProvider, value); } + + public Motion? Motion { get => this.Tag == ActionTag.Motion ? (Motion)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.Motion, value); } + + public Action(ActionTag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected Action() + { + } + } + + public enum ActionTag + { + RegisterKnownNeuron, + ManageNeuron, + ExecuteNnsFunction, + RewardNodeProvider, + SetDefaultFollowees, + RewardNodeProviders, + ManageNetworkEconomics, + ApproveGenesisKyc, + AddOrRemoveNodeProvider, + Motion + } +} + +Type File: 'AddHotKey' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; + +namespace Test.Models +{ + public class AddHotKey + { + [CandidName("new_hot_key")] + public OptionalValue NewHotKey { get; set; } + + public AddHotKey(OptionalValue newHotKey) + { + this.NewHotKey = newHotKey; + } + + public AddHotKey() + { + } + } +} + +Type File: 'AddOrRemoveNodeProvider' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class AddOrRemoveNodeProvider + { + [CandidName("change")] + public OptionalValue Change { get; set; } + + public AddOrRemoveNodeProvider(OptionalValue change) + { + this.Change = change; + } + + public AddOrRemoveNodeProvider() + { + } + } +} + +Type File: 'Amount' + +using EdjCase.ICP.Candid.Mapping; + +namespace Test.Models +{ + public class Amount + { + [CandidName("e8s")] + public ulong E8s { get; set; } + + public Amount(ulong e8s) + { + this.E8s = e8s; + } + + public Amount() + { + } + } +} + +Type File: 'ApproveGenesisKyc' + +using EdjCase.ICP.Candid.Mapping; +using System.Collections.Generic; +using EdjCase.ICP.Candid.Models; + +namespace Test.Models +{ + public class ApproveGenesisKyc + { + [CandidName("principals")] + public List Principals { get; set; } + + public ApproveGenesisKyc(List principals) + { + this.Principals = principals; + } + + public ApproveGenesisKyc() + { + } + } +} + +Type File: 'Ballot' + +using EdjCase.ICP.Candid.Mapping; + +namespace Test.Models +{ + public class Ballot + { + [CandidName("vote")] + public int Vote { get; set; } + + [CandidName("voting_power")] + public ulong VotingPower { get; set; } + + public Ballot(int vote, ulong votingPower) + { + this.Vote = vote; + this.VotingPower = votingPower; + } + + public Ballot() + { + } + } +} + +Type File: 'BallotInfo' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class BallotInfo + { + [CandidName("vote")] + public int Vote { get; set; } + + [CandidName("proposal_id")] + public OptionalValue ProposalId { get; set; } + + public BallotInfo(int vote, OptionalValue proposalId) + { + this.Vote = vote; + this.ProposalId = proposalId; + } + + public BallotInfo() + { + } + } +} + +Type File: 'By' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; + +namespace Test.Models +{ + [Variant()] + public class By + { + [VariantTagProperty()] + public ByTag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public By.NeuronIdOrSubaccountInfo? NeuronIdOrSubaccount { get => this.Tag == ByTag.NeuronIdOrSubaccount ? (By.NeuronIdOrSubaccountInfo)this.Value! : default; set => (this.Tag, this.Value) = (ByTag.NeuronIdOrSubaccount, value); } + + public ClaimOrRefreshNeuronFromAccount? MemoAndController { get => this.Tag == ByTag.MemoAndController ? (ClaimOrRefreshNeuronFromAccount)this.Value! : default; set => (this.Tag, this.Value) = (ByTag.MemoAndController, value); } + + public ulong? Memo { get => this.Tag == ByTag.Memo ? (ulong)this.Value! : default; set => (this.Tag, this.Value) = (ByTag.Memo, value); } + + public By(ByTag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected By() + { + } + + public class NeuronIdOrSubaccountInfo + { + public NeuronIdOrSubaccountInfo() + { + } + } + } + + public enum ByTag + { + NeuronIdOrSubaccount, + MemoAndController, + Memo + } +} + +Type File: 'Change' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; + +namespace Test.Models +{ + [Variant()] + public class Change + { + [VariantTagProperty()] + public ChangeTag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public NodeProvider? ToRemove { get => this.Tag == ChangeTag.ToRemove ? (NodeProvider)this.Value! : default; set => (this.Tag, this.Value) = (ChangeTag.ToRemove, value); } + + public NodeProvider? ToAdd { get => this.Tag == ChangeTag.ToAdd ? (NodeProvider)this.Value! : default; set => (this.Tag, this.Value) = (ChangeTag.ToAdd, value); } + + public Change(ChangeTag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected Change() + { + } + } + + public enum ChangeTag + { + ToRemove, + ToAdd + } +} + +Type File: 'ClaimOrRefresh' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class ClaimOrRefresh + { + [CandidName("by")] + public OptionalValue By { get; set; } + + public ClaimOrRefresh(OptionalValue by) + { + this.By = by; + } + + public ClaimOrRefresh() + { + } + } +} + +Type File: 'ClaimOrRefreshNeuronFromAccount' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; + +namespace Test.Models +{ + public class ClaimOrRefreshNeuronFromAccount + { + [CandidName("controller")] + public OptionalValue Controller { get; set; } + + [CandidName("memo")] + public ulong Memo { get; set; } + + public ClaimOrRefreshNeuronFromAccount(OptionalValue controller, ulong memo) + { + this.Controller = controller; + this.Memo = memo; + } + + public ClaimOrRefreshNeuronFromAccount() + { + } + } +} + +Type File: 'ClaimOrRefreshNeuronFromAccountResponse' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class ClaimOrRefreshNeuronFromAccountResponse + { + [CandidName("result")] + public OptionalValue Result { get; set; } + + public ClaimOrRefreshNeuronFromAccountResponse(OptionalValue result) + { + this.Result = result; + } + + public ClaimOrRefreshNeuronFromAccountResponse() + { + } + } +} + +Type File: 'ClaimOrRefreshResponse' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class ClaimOrRefreshResponse + { + [CandidName("refreshed_neuron_id")] + public OptionalValue RefreshedNeuronId { get; set; } + + public ClaimOrRefreshResponse(OptionalValue refreshedNeuronId) + { + this.RefreshedNeuronId = refreshedNeuronId; + } + + public ClaimOrRefreshResponse() + { + } + } +} + +Type File: 'Command' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; + +namespace Test.Models +{ + [Variant()] + public class Command + { + [VariantTagProperty()] + public CommandTag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public Spawn? Spawn { get => this.Tag == CommandTag.Spawn ? (Spawn)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.Spawn, value); } + + public Split? Split { get => this.Tag == CommandTag.Split ? (Split)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.Split, value); } + + public Follow? Follow { get => this.Tag == CommandTag.Follow ? (Follow)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.Follow, value); } + + public ClaimOrRefresh? ClaimOrRefresh { get => this.Tag == CommandTag.ClaimOrRefresh ? (ClaimOrRefresh)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.ClaimOrRefresh, value); } + + public Configure? Configure { get => this.Tag == CommandTag.Configure ? (Configure)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.Configure, value); } + + public RegisterVote? RegisterVote { get => this.Tag == CommandTag.RegisterVote ? (RegisterVote)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.RegisterVote, value); } + + public Merge? Merge { get => this.Tag == CommandTag.Merge ? (Merge)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.Merge, value); } + + public DisburseToNeuron? DisburseToNeuron { get => this.Tag == CommandTag.DisburseToNeuron ? (DisburseToNeuron)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.DisburseToNeuron, value); } + + public Proposal? MakeProposal { get => this.Tag == CommandTag.MakeProposal ? (Proposal)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.MakeProposal, value); } + + public MergeMaturity? MergeMaturity { get => this.Tag == CommandTag.MergeMaturity ? (MergeMaturity)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.MergeMaturity, value); } + + public Disburse? Disburse { get => this.Tag == CommandTag.Disburse ? (Disburse)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.Disburse, value); } + + public Command(CommandTag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected Command() + { + } + } + + public enum CommandTag + { + Spawn, + Split, + Follow, + ClaimOrRefresh, + Configure, + RegisterVote, + Merge, + DisburseToNeuron, + MakeProposal, + MergeMaturity, + Disburse + } +} + +Type File: 'Command1' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; + +namespace Test.Models +{ + [Variant()] + public class Command1 + { + [VariantTagProperty()] + public Command1Tag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public GovernanceError? Error { get => this.Tag == Command1Tag.Error ? (GovernanceError)this.Value! : default; set => (this.Tag, this.Value) = (Command1Tag.Error, value); } + + public SpawnResponse? Spawn { get => this.Tag == Command1Tag.Spawn ? (SpawnResponse)this.Value! : default; set => (this.Tag, this.Value) = (Command1Tag.Spawn, value); } + + public SpawnResponse? Split { get => this.Tag == Command1Tag.Split ? (SpawnResponse)this.Value! : default; set => (this.Tag, this.Value) = (Command1Tag.Split, value); } + + public Command1.FollowInfo? Follow { get => this.Tag == Command1Tag.Follow ? (Command1.FollowInfo)this.Value! : default; set => (this.Tag, this.Value) = (Command1Tag.Follow, value); } + + public ClaimOrRefreshResponse? ClaimOrRefresh { get => this.Tag == Command1Tag.ClaimOrRefresh ? (ClaimOrRefreshResponse)this.Value! : default; set => (this.Tag, this.Value) = (Command1Tag.ClaimOrRefresh, value); } + + public Command1.ConfigureInfo? Configure { get => this.Tag == Command1Tag.Configure ? (Command1.ConfigureInfo)this.Value! : default; set => (this.Tag, this.Value) = (Command1Tag.Configure, value); } + + public Command1.RegisterVoteInfo? RegisterVote { get => this.Tag == Command1Tag.RegisterVote ? (Command1.RegisterVoteInfo)this.Value! : default; set => (this.Tag, this.Value) = (Command1Tag.RegisterVote, value); } + + public Command1.MergeInfo? Merge { get => this.Tag == Command1Tag.Merge ? (Command1.MergeInfo)this.Value! : default; set => (this.Tag, this.Value) = (Command1Tag.Merge, value); } + + public SpawnResponse? DisburseToNeuron { get => this.Tag == Command1Tag.DisburseToNeuron ? (SpawnResponse)this.Value! : default; set => (this.Tag, this.Value) = (Command1Tag.DisburseToNeuron, value); } + + public MakeProposalResponse? MakeProposal { get => this.Tag == Command1Tag.MakeProposal ? (MakeProposalResponse)this.Value! : default; set => (this.Tag, this.Value) = (Command1Tag.MakeProposal, value); } + + public MergeMaturityResponse? MergeMaturity { get => this.Tag == Command1Tag.MergeMaturity ? (MergeMaturityResponse)this.Value! : default; set => (this.Tag, this.Value) = (Command1Tag.MergeMaturity, value); } + + public DisburseResponse? Disburse { get => this.Tag == Command1Tag.Disburse ? (DisburseResponse)this.Value! : default; set => (this.Tag, this.Value) = (Command1Tag.Disburse, value); } + + public Command1(Command1Tag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected Command1() + { + } + + public class FollowInfo + { + public FollowInfo() + { + } + } + + public class ConfigureInfo + { + public ConfigureInfo() + { + } + } + + public class RegisterVoteInfo + { + public RegisterVoteInfo() + { + } + } + + public class MergeInfo + { + public MergeInfo() + { + } + } + } + + public enum Command1Tag + { + Error, + Spawn, + Split, + Follow, + ClaimOrRefresh, + Configure, + RegisterVote, + Merge, + DisburseToNeuron, + MakeProposal, + MergeMaturity, + Disburse + } +} + +Type File: 'Command2' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; + +namespace Test.Models +{ + [Variant()] + public class Command2 + { + [VariantTagProperty()] + public Command2Tag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public Spawn? Spawn { get => this.Tag == Command2Tag.Spawn ? (Spawn)this.Value! : default; set => (this.Tag, this.Value) = (Command2Tag.Spawn, value); } + + public Split? Split { get => this.Tag == Command2Tag.Split ? (Split)this.Value! : default; set => (this.Tag, this.Value) = (Command2Tag.Split, value); } + + public Configure? Configure { get => this.Tag == Command2Tag.Configure ? (Configure)this.Value! : default; set => (this.Tag, this.Value) = (Command2Tag.Configure, value); } + + public Merge? Merge { get => this.Tag == Command2Tag.Merge ? (Merge)this.Value! : default; set => (this.Tag, this.Value) = (Command2Tag.Merge, value); } + + public DisburseToNeuron? DisburseToNeuron { get => this.Tag == Command2Tag.DisburseToNeuron ? (DisburseToNeuron)this.Value! : default; set => (this.Tag, this.Value) = (Command2Tag.DisburseToNeuron, value); } + + public ClaimOrRefresh? ClaimOrRefreshNeuron { get => this.Tag == Command2Tag.ClaimOrRefreshNeuron ? (ClaimOrRefresh)this.Value! : default; set => (this.Tag, this.Value) = (Command2Tag.ClaimOrRefreshNeuron, value); } + + public MergeMaturity? MergeMaturity { get => this.Tag == Command2Tag.MergeMaturity ? (MergeMaturity)this.Value! : default; set => (this.Tag, this.Value) = (Command2Tag.MergeMaturity, value); } + + public Disburse? Disburse { get => this.Tag == Command2Tag.Disburse ? (Disburse)this.Value! : default; set => (this.Tag, this.Value) = (Command2Tag.Disburse, value); } + + public Command2(Command2Tag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected Command2() + { + } + } + + public enum Command2Tag + { + Spawn, + Split, + Configure, + Merge, + DisburseToNeuron, + ClaimOrRefreshNeuron, + MergeMaturity, + Disburse + } +} + +Type File: 'Configure' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class Configure + { + [CandidName("operation")] + public OptionalValue Operation { get; set; } + + public Configure(OptionalValue operation) + { + this.Operation = operation; + } + + public Configure() + { + } + } +} + +Type File: 'Disburse' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class Disburse + { + [CandidName("to_account")] + public OptionalValue ToAccount { get; set; } + + [CandidName("amount")] + public OptionalValue Amount { get; set; } + + public Disburse(OptionalValue toAccount, OptionalValue amount) + { + this.ToAccount = toAccount; + this.Amount = amount; + } + + public Disburse() + { + } + } +} + +Type File: 'DisburseResponse' + +using EdjCase.ICP.Candid.Mapping; + +namespace Test.Models +{ + public class DisburseResponse + { + [CandidName("transfer_block_height")] + public ulong TransferBlockHeight { get; set; } + + public DisburseResponse(ulong transferBlockHeight) + { + this.TransferBlockHeight = transferBlockHeight; + } + + public DisburseResponse() + { + } + } +} + +Type File: 'DisburseToNeuron' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; + +namespace Test.Models +{ + public class DisburseToNeuron + { + [CandidName("dissolve_delay_seconds")] + public ulong DissolveDelaySeconds { get; set; } + + [CandidName("kyc_verified")] + public bool KycVerified { get; set; } + + [CandidName("amount_e8s")] + public ulong AmountE8s { get; set; } + + [CandidName("new_controller")] + public OptionalValue NewController { get; set; } + + [CandidName("nonce")] + public ulong Nonce { get; set; } + + public DisburseToNeuron(ulong dissolveDelaySeconds, bool kycVerified, ulong amountE8s, OptionalValue newController, ulong nonce) + { + this.DissolveDelaySeconds = dissolveDelaySeconds; + this.KycVerified = kycVerified; + this.AmountE8s = amountE8s; + this.NewController = newController; + this.Nonce = nonce; + } + + public DisburseToNeuron() + { + } + } +} + +Type File: 'DissolveState' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; + +namespace Test.Models +{ + [Variant()] + public class DissolveState + { + [VariantTagProperty()] + public DissolveStateTag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public ulong? DissolveDelaySeconds { get => this.Tag == DissolveStateTag.DissolveDelaySeconds ? (ulong)this.Value! : default; set => (this.Tag, this.Value) = (DissolveStateTag.DissolveDelaySeconds, value); } + + public ulong? WhenDissolvedTimestampSeconds { get => this.Tag == DissolveStateTag.WhenDissolvedTimestampSeconds ? (ulong)this.Value! : default; set => (this.Tag, this.Value) = (DissolveStateTag.WhenDissolvedTimestampSeconds, value); } + + public DissolveState(DissolveStateTag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected DissolveState() + { + } + } + + public enum DissolveStateTag + { + DissolveDelaySeconds, + WhenDissolvedTimestampSeconds + } +} + +Type File: 'ExecuteNnsFunction' + +using EdjCase.ICP.Candid.Mapping; +using System.Collections.Generic; + +namespace Test.Models +{ + public class ExecuteNnsFunction + { + [CandidName("nns_function")] + public int NnsFunction { get; set; } + + [CandidName("payload")] + public List Payload { get; set; } + + public ExecuteNnsFunction(int nnsFunction, List payload) + { + this.NnsFunction = nnsFunction; + this.Payload = payload; + } + + public ExecuteNnsFunction() + { + } + } +} + +Type File: 'Follow' + +using EdjCase.ICP.Candid.Mapping; +using System.Collections.Generic; +using Test.Models; + +namespace Test.Models +{ + public class Follow + { + [CandidName("topic")] + public int Topic { get; set; } + + [CandidName("followees")] + public List Followees { get; set; } + + public Follow(int topic, List followees) + { + this.Topic = topic; + this.Followees = followees; + } + + public Follow() + { + } + } +} + +Type File: 'Followees' + +using EdjCase.ICP.Candid.Mapping; +using System.Collections.Generic; +using Test.Models; + +namespace Test.Models +{ + public class Followees + { + [CandidName("followees")] + public List Followees_ { get; set; } + + public Followees(List followees) + { + this.Followees_ = followees; + } + + public Followees() + { + } + } +} + +Type File: 'Governance' + +using EdjCase.ICP.Candid.Mapping; +using System.Collections.Generic; +using Test.Models; +using EdjCase.ICP.Candid.Models; + +namespace Test.Models +{ + public class Governance + { + [CandidName("default_followees")] + public Dictionary DefaultFollowees { get; set; } + + [CandidName("wait_for_quiet_threshold_seconds")] + public ulong WaitForQuietThresholdSeconds { get; set; } + + [CandidName("metrics")] + public OptionalValue Metrics { get; set; } + + [CandidName("node_providers")] + public List NodeProviders { get; set; } + + [CandidName("economics")] + public OptionalValue Economics { get; set; } + + [CandidName("latest_reward_event")] + public OptionalValue LatestRewardEvent { get; set; } + + [CandidName("to_claim_transfers")] + public List ToClaimTransfers { get; set; } + + [CandidName("short_voting_period_seconds")] + public ulong ShortVotingPeriodSeconds { get; set; } + + [CandidName("proposals")] + public Dictionary Proposals { get; set; } + + [CandidName("in_flight_commands")] + public Dictionary InFlightCommands { get; set; } + + [CandidName("neurons")] + public Dictionary Neurons { get; set; } + + [CandidName("genesis_timestamp_seconds")] + public ulong GenesisTimestampSeconds { get; set; } + + public Governance(Dictionary defaultFollowees, ulong waitForQuietThresholdSeconds, OptionalValue metrics, List nodeProviders, OptionalValue economics, OptionalValue latestRewardEvent, List toClaimTransfers, ulong shortVotingPeriodSeconds, Dictionary proposals, Dictionary inFlightCommands, Dictionary neurons, ulong genesisTimestampSeconds) + { + this.DefaultFollowees = defaultFollowees; + this.WaitForQuietThresholdSeconds = waitForQuietThresholdSeconds; + this.Metrics = metrics; + this.NodeProviders = nodeProviders; + this.Economics = economics; + this.LatestRewardEvent = latestRewardEvent; + this.ToClaimTransfers = toClaimTransfers; + this.ShortVotingPeriodSeconds = shortVotingPeriodSeconds; + this.Proposals = proposals; + this.InFlightCommands = inFlightCommands; + this.Neurons = neurons; + this.GenesisTimestampSeconds = genesisTimestampSeconds; + } + + public Governance() + { + } + } +} + +Type File: 'GovernanceCachedMetrics' + +using EdjCase.ICP.Candid.Mapping; +using System.Collections.Generic; + +namespace Test.Models +{ + public class GovernanceCachedMetrics + { + [CandidName("not_dissolving_neurons_e8s_buckets")] + public Dictionary NotDissolvingNeuronsE8sBuckets { get; set; } + + [CandidName("garbage_collectable_neurons_count")] + public ulong GarbageCollectableNeuronsCount { get; set; } + + [CandidName("neurons_with_invalid_stake_count")] + public ulong NeuronsWithInvalidStakeCount { get; set; } + + [CandidName("not_dissolving_neurons_count_buckets")] + public Dictionary NotDissolvingNeuronsCountBuckets { get; set; } + + [CandidName("total_supply_icp")] + public ulong TotalSupplyIcp { get; set; } + + [CandidName("neurons_with_less_than_6_months_dissolve_delay_count")] + public ulong NeuronsWithLessThan6MonthsDissolveDelayCount { get; set; } + + [CandidName("dissolved_neurons_count")] + public ulong DissolvedNeuronsCount { get; set; } + + [CandidName("total_staked_e8s")] + public ulong TotalStakedE8s { get; set; } + + [CandidName("not_dissolving_neurons_count")] + public ulong NotDissolvingNeuronsCount { get; set; } + + [CandidName("dissolved_neurons_e8s")] + public ulong DissolvedNeuronsE8s { get; set; } + + [CandidName("neurons_with_less_than_6_months_dissolve_delay_e8s")] + public ulong NeuronsWithLessThan6MonthsDissolveDelayE8s { get; set; } + + [CandidName("dissolving_neurons_count_buckets")] + public Dictionary DissolvingNeuronsCountBuckets { get; set; } + + [CandidName("dissolving_neurons_count")] + public ulong DissolvingNeuronsCount { get; set; } + + [CandidName("dissolving_neurons_e8s_buckets")] + public Dictionary DissolvingNeuronsE8sBuckets { get; set; } + + [CandidName("community_fund_total_staked_e8s")] + public ulong CommunityFundTotalStakedE8s { get; set; } + + [CandidName("timestamp_seconds")] + public ulong TimestampSeconds { get; set; } + + public GovernanceCachedMetrics(Dictionary notDissolvingNeuronsE8sBuckets, ulong garbageCollectableNeuronsCount, ulong neuronsWithInvalidStakeCount, Dictionary notDissolvingNeuronsCountBuckets, ulong totalSupplyIcp, ulong neuronsWithLessThan6MonthsDissolveDelayCount, ulong dissolvedNeuronsCount, ulong totalStakedE8s, ulong notDissolvingNeuronsCount, ulong dissolvedNeuronsE8s, ulong neuronsWithLessThan6MonthsDissolveDelayE8s, Dictionary dissolvingNeuronsCountBuckets, ulong dissolvingNeuronsCount, Dictionary dissolvingNeuronsE8sBuckets, ulong communityFundTotalStakedE8s, ulong timestampSeconds) + { + this.NotDissolvingNeuronsE8sBuckets = notDissolvingNeuronsE8sBuckets; + this.GarbageCollectableNeuronsCount = garbageCollectableNeuronsCount; + this.NeuronsWithInvalidStakeCount = neuronsWithInvalidStakeCount; + this.NotDissolvingNeuronsCountBuckets = notDissolvingNeuronsCountBuckets; + this.TotalSupplyIcp = totalSupplyIcp; + this.NeuronsWithLessThan6MonthsDissolveDelayCount = neuronsWithLessThan6MonthsDissolveDelayCount; + this.DissolvedNeuronsCount = dissolvedNeuronsCount; + this.TotalStakedE8s = totalStakedE8s; + this.NotDissolvingNeuronsCount = notDissolvingNeuronsCount; + this.DissolvedNeuronsE8s = dissolvedNeuronsE8s; + this.NeuronsWithLessThan6MonthsDissolveDelayE8s = neuronsWithLessThan6MonthsDissolveDelayE8s; + this.DissolvingNeuronsCountBuckets = dissolvingNeuronsCountBuckets; + this.DissolvingNeuronsCount = dissolvingNeuronsCount; + this.DissolvingNeuronsE8sBuckets = dissolvingNeuronsE8sBuckets; + this.CommunityFundTotalStakedE8s = communityFundTotalStakedE8s; + this.TimestampSeconds = timestampSeconds; + } + + public GovernanceCachedMetrics() + { + } + } +} + +Type File: 'GovernanceError' + +using EdjCase.ICP.Candid.Mapping; + +namespace Test.Models +{ + public class GovernanceError + { + [CandidName("error_message")] + public string ErrorMessage { get; set; } + + [CandidName("error_type")] + public int ErrorType { get; set; } + + public GovernanceError(string errorMessage, int errorType) + { + this.ErrorMessage = errorMessage; + this.ErrorType = errorType; + } + + public GovernanceError() + { + } + } +} + +Type File: 'IncreaseDissolveDelay' + +using EdjCase.ICP.Candid.Mapping; + +namespace Test.Models +{ + public class IncreaseDissolveDelay + { + [CandidName("additional_dissolve_delay_seconds")] + public uint AdditionalDissolveDelaySeconds { get; set; } + + public IncreaseDissolveDelay(uint additionalDissolveDelaySeconds) + { + this.AdditionalDissolveDelaySeconds = additionalDissolveDelaySeconds; + } + + public IncreaseDissolveDelay() + { + } + } +} + +Type File: 'KnownNeuron' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class KnownNeuron + { + [CandidName("id")] + public OptionalValue Id { get; set; } + + [CandidName("known_neuron_data")] + public OptionalValue KnownNeuronData { get; set; } + + public KnownNeuron(OptionalValue id, OptionalValue knownNeuronData) + { + this.Id = id; + this.KnownNeuronData = knownNeuronData; + } + + public KnownNeuron() + { + } + } +} + +Type File: 'KnownNeuronData' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; + +namespace Test.Models +{ + public class KnownNeuronData + { + [CandidName("name")] + public string Name { get; set; } + + [CandidName("description")] + public OptionalValue Description { get; set; } + + public KnownNeuronData(string name, OptionalValue description) + { + this.Name = name; + this.Description = description; + } + + public KnownNeuronData() + { + } + } +} + +Type File: 'ListKnownNeuronsResponse' + +using EdjCase.ICP.Candid.Mapping; +using System.Collections.Generic; +using Test.Models; + +namespace Test.Models +{ + public class ListKnownNeuronsResponse + { + [CandidName("known_neurons")] + public List KnownNeurons { get; set; } + + public ListKnownNeuronsResponse(List knownNeurons) + { + this.KnownNeurons = knownNeurons; + } + + public ListKnownNeuronsResponse() + { + } + } +} + +Type File: 'ListNeurons' + +using EdjCase.ICP.Candid.Mapping; +using System.Collections.Generic; + +namespace Test.Models +{ + public class ListNeurons + { + [CandidName("neuron_ids")] + public List NeuronIds { get; set; } + + [CandidName("include_neurons_readable_by_caller")] + public bool IncludeNeuronsReadableByCaller { get; set; } + + public ListNeurons(List neuronIds, bool includeNeuronsReadableByCaller) + { + this.NeuronIds = neuronIds; + this.IncludeNeuronsReadableByCaller = includeNeuronsReadableByCaller; + } + + public ListNeurons() + { + } + } +} + +Type File: 'ListNeuronsResponse' + +using EdjCase.ICP.Candid.Mapping; +using System.Collections.Generic; +using Test.Models; + +namespace Test.Models +{ + public class ListNeuronsResponse + { + [CandidName("neuron_infos")] + public Dictionary NeuronInfos { get; set; } + + [CandidName("full_neurons")] + public List FullNeurons { get; set; } + + public ListNeuronsResponse(Dictionary neuronInfos, List fullNeurons) + { + this.NeuronInfos = neuronInfos; + this.FullNeurons = fullNeurons; + } + + public ListNeuronsResponse() + { + } + } +} + +Type File: 'ListNodeProvidersResponse' + +using EdjCase.ICP.Candid.Mapping; +using System.Collections.Generic; +using Test.Models; + +namespace Test.Models +{ + public class ListNodeProvidersResponse + { + [CandidName("node_providers")] + public List NodeProviders { get; set; } + + public ListNodeProvidersResponse(List nodeProviders) + { + this.NodeProviders = nodeProviders; + } + + public ListNodeProvidersResponse() + { + } + } +} + +Type File: 'ListProposalInfo' + +using EdjCase.ICP.Candid.Mapping; +using System.Collections.Generic; +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class ListProposalInfo + { + [CandidName("include_reward_status")] + public List IncludeRewardStatus { get; set; } + + [CandidName("before_proposal")] + public OptionalValue BeforeProposal { get; set; } + + [CandidName("limit")] + public uint Limit { get; set; } + + [CandidName("exclude_topic")] + public List ExcludeTopic { get; set; } + + [CandidName("include_status")] + public List IncludeStatus { get; set; } + + public ListProposalInfo(List includeRewardStatus, OptionalValue beforeProposal, uint limit, List excludeTopic, List includeStatus) + { + this.IncludeRewardStatus = includeRewardStatus; + this.BeforeProposal = beforeProposal; + this.Limit = limit; + this.ExcludeTopic = excludeTopic; + this.IncludeStatus = includeStatus; + } + + public ListProposalInfo() + { + } + } +} + +Type File: 'ListProposalInfoResponse' + +using EdjCase.ICP.Candid.Mapping; +using System.Collections.Generic; +using Test.Models; + +namespace Test.Models +{ + public class ListProposalInfoResponse + { + [CandidName("proposal_info")] + public List ProposalInfo { get; set; } + + public ListProposalInfoResponse(List proposalInfo) + { + this.ProposalInfo = proposalInfo; + } + + public ListProposalInfoResponse() + { + } + } +} + +Type File: 'MakeProposalResponse' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class MakeProposalResponse + { + [CandidName("proposal_id")] + public OptionalValue ProposalId { get; set; } + + public MakeProposalResponse(OptionalValue proposalId) + { + this.ProposalId = proposalId; + } + + public MakeProposalResponse() + { + } + } +} + +Type File: 'ManageNeuron' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class ManageNeuron + { + [CandidName("id")] + public OptionalValue Id { get; set; } + + [CandidName("command")] + public OptionalValue Command { get; set; } + + [CandidName("neuron_id_or_subaccount")] + public OptionalValue NeuronIdOrSubaccount { get; set; } + + public ManageNeuron(OptionalValue id, OptionalValue command, OptionalValue neuronIdOrSubaccount) + { + this.Id = id; + this.Command = command; + this.NeuronIdOrSubaccount = neuronIdOrSubaccount; + } + + public ManageNeuron() + { + } + } +} + +Type File: 'ManageNeuronResponse' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class ManageNeuronResponse + { + [CandidName("command")] + public OptionalValue Command { get; set; } + + public ManageNeuronResponse(OptionalValue command) + { + this.Command = command; + } + + public ManageNeuronResponse() + { + } + } +} + +Type File: 'Merge' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class Merge + { + [CandidName("source_neuron_id")] + public OptionalValue SourceNeuronId { get; set; } + + public Merge(OptionalValue sourceNeuronId) + { + this.SourceNeuronId = sourceNeuronId; + } + + public Merge() + { + } + } +} + +Type File: 'MergeMaturity' + +using EdjCase.ICP.Candid.Mapping; + +namespace Test.Models +{ + public class MergeMaturity + { + [CandidName("percentage_to_merge")] + public uint PercentageToMerge { get; set; } + + public MergeMaturity(uint percentageToMerge) + { + this.PercentageToMerge = percentageToMerge; + } + + public MergeMaturity() + { + } + } +} + +Type File: 'MergeMaturityResponse' + +using EdjCase.ICP.Candid.Mapping; + +namespace Test.Models +{ + public class MergeMaturityResponse + { + [CandidName("merged_maturity_e8s")] + public ulong MergedMaturityE8s { get; set; } + + [CandidName("new_stake_e8s")] + public ulong NewStakeE8s { get; set; } + + public MergeMaturityResponse(ulong mergedMaturityE8s, ulong newStakeE8s) + { + this.MergedMaturityE8s = mergedMaturityE8s; + this.NewStakeE8s = newStakeE8s; + } + + public MergeMaturityResponse() + { + } + } +} + +Type File: 'Motion' + +using EdjCase.ICP.Candid.Mapping; + +namespace Test.Models +{ + public class Motion + { + [CandidName("motion_text")] + public string MotionText { get; set; } + + public Motion(string motionText) + { + this.MotionText = motionText; + } + + public Motion() + { + } + } +} + +Type File: 'NetworkEconomics' + +using EdjCase.ICP.Candid.Mapping; + +namespace Test.Models +{ + public class NetworkEconomics + { + [CandidName("neuron_minimum_stake_e8s")] + public ulong NeuronMinimumStakeE8s { get; set; } + + [CandidName("max_proposals_to_keep_per_topic")] + public uint MaxProposalsToKeepPerTopic { get; set; } + + [CandidName("neuron_management_fee_per_proposal_e8s")] + public ulong NeuronManagementFeePerProposalE8s { get; set; } + + [CandidName("reject_cost_e8s")] + public ulong RejectCostE8s { get; set; } + + [CandidName("transaction_fee_e8s")] + public ulong TransactionFeeE8s { get; set; } + + [CandidName("neuron_spawn_dissolve_delay_seconds")] + public ulong NeuronSpawnDissolveDelaySeconds { get; set; } + + [CandidName("minimum_icp_xdr_rate")] + public ulong MinimumIcpXdrRate { get; set; } + + [CandidName("maximum_node_provider_rewards_e8s")] + public ulong MaximumNodeProviderRewardsE8s { get; set; } + + public NetworkEconomics(ulong neuronMinimumStakeE8s, uint maxProposalsToKeepPerTopic, ulong neuronManagementFeePerProposalE8s, ulong rejectCostE8s, ulong transactionFeeE8s, ulong neuronSpawnDissolveDelaySeconds, ulong minimumIcpXdrRate, ulong maximumNodeProviderRewardsE8s) + { + this.NeuronMinimumStakeE8s = neuronMinimumStakeE8s; + this.MaxProposalsToKeepPerTopic = maxProposalsToKeepPerTopic; + this.NeuronManagementFeePerProposalE8s = neuronManagementFeePerProposalE8s; + this.RejectCostE8s = rejectCostE8s; + this.TransactionFeeE8s = transactionFeeE8s; + this.NeuronSpawnDissolveDelaySeconds = neuronSpawnDissolveDelaySeconds; + this.MinimumIcpXdrRate = minimumIcpXdrRate; + this.MaximumNodeProviderRewardsE8s = maximumNodeProviderRewardsE8s; + } + + public NetworkEconomics() + { + } + } +} + +Type File: 'Neuron' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test.Models; +using System.Collections.Generic; + +namespace Test.Models +{ + public class Neuron + { + [CandidName("id")] + public OptionalValue Id { get; set; } + + [CandidName("controller")] + public OptionalValue Controller { get; set; } + + [CandidName("recent_ballots")] + public List RecentBallots { get; set; } + + [CandidName("kyc_verified")] + public bool KycVerified { get; set; } + + [CandidName("not_for_profit")] + public bool NotForProfit { get; set; } + + [CandidName("maturity_e8s_equivalent")] + public ulong MaturityE8sEquivalent { get; set; } + + [CandidName("cached_neuron_stake_e8s")] + public ulong CachedNeuronStakeE8s { get; set; } + + [CandidName("created_timestamp_seconds")] + public ulong CreatedTimestampSeconds { get; set; } + + [CandidName("aging_since_timestamp_seconds")] + public ulong AgingSinceTimestampSeconds { get; set; } + + [CandidName("hot_keys")] + public List HotKeys { get; set; } + + [CandidName("account")] + public List Account { get; set; } + + [CandidName("joined_community_fund_timestamp_seconds")] + public OptionalValue JoinedCommunityFundTimestampSeconds { get; set; } + + [CandidName("dissolve_state")] + public OptionalValue DissolveState { get; set; } + + [CandidName("followees")] + public Dictionary Followees { get; set; } + + [CandidName("neuron_fees_e8s")] + public ulong NeuronFeesE8s { get; set; } + + [CandidName("transfer")] + public OptionalValue Transfer { get; set; } + + [CandidName("known_neuron_data")] + public OptionalValue KnownNeuronData { get; set; } + + public Neuron(OptionalValue id, OptionalValue controller, List recentBallots, bool kycVerified, bool notForProfit, ulong maturityE8sEquivalent, ulong cachedNeuronStakeE8s, ulong createdTimestampSeconds, ulong agingSinceTimestampSeconds, List hotKeys, List account, OptionalValue joinedCommunityFundTimestampSeconds, OptionalValue dissolveState, Dictionary followees, ulong neuronFeesE8s, OptionalValue transfer, OptionalValue knownNeuronData) + { + this.Id = id; + this.Controller = controller; + this.RecentBallots = recentBallots; + this.KycVerified = kycVerified; + this.NotForProfit = notForProfit; + this.MaturityE8sEquivalent = maturityE8sEquivalent; + this.CachedNeuronStakeE8s = cachedNeuronStakeE8s; + this.CreatedTimestampSeconds = createdTimestampSeconds; + this.AgingSinceTimestampSeconds = agingSinceTimestampSeconds; + this.HotKeys = hotKeys; + this.Account = account; + this.JoinedCommunityFundTimestampSeconds = joinedCommunityFundTimestampSeconds; + this.DissolveState = dissolveState; + this.Followees = followees; + this.NeuronFeesE8s = neuronFeesE8s; + this.Transfer = transfer; + this.KnownNeuronData = knownNeuronData; + } + + public Neuron() + { + } + } +} + +Type File: 'NeuronId' + +using EdjCase.ICP.Candid.Mapping; + +namespace Test.Models +{ + public class NeuronId + { + [CandidName("id")] + public ulong Id { get; set; } + + public NeuronId(ulong id) + { + this.Id = id; + } + + public NeuronId() + { + } + } +} + +Type File: 'NeuronIdOrSubaccount' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; +using System.Collections.Generic; + +namespace Test.Models +{ + [Variant()] + public class NeuronIdOrSubaccount + { + [VariantTagProperty()] + public NeuronIdOrSubaccountTag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public List? Subaccount { get => this.Tag == NeuronIdOrSubaccountTag.Subaccount ? (List)this.Value! : default; set => (this.Tag, this.Value) = (NeuronIdOrSubaccountTag.Subaccount, value); } + + public NeuronId? NeuronId { get => this.Tag == NeuronIdOrSubaccountTag.NeuronId ? (NeuronId)this.Value! : default; set => (this.Tag, this.Value) = (NeuronIdOrSubaccountTag.NeuronId, value); } + + public NeuronIdOrSubaccount(NeuronIdOrSubaccountTag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected NeuronIdOrSubaccount() + { + } + } + + public enum NeuronIdOrSubaccountTag + { + Subaccount, + NeuronId + } +} + +Type File: 'NeuronInFlightCommand' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class NeuronInFlightCommand + { + [CandidName("command")] + public OptionalValue Command { get; set; } + + [CandidName("timestamp")] + public ulong Timestamp { get; set; } + + public NeuronInFlightCommand(OptionalValue command, ulong timestamp) + { + this.Command = command; + this.Timestamp = timestamp; + } + + public NeuronInFlightCommand() + { + } + } +} + +Type File: 'NeuronInfo' + +using EdjCase.ICP.Candid.Mapping; +using System.Collections.Generic; +using Test.Models; +using EdjCase.ICP.Candid.Models; + +namespace Test.Models +{ + public class NeuronInfo + { + [CandidName("dissolve_delay_seconds")] + public ulong DissolveDelaySeconds { get; set; } + + [CandidName("recent_ballots")] + public List RecentBallots { get; set; } + + [CandidName("created_timestamp_seconds")] + public ulong CreatedTimestampSeconds { get; set; } + + [CandidName("state")] + public int State { get; set; } + + [CandidName("stake_e8s")] + public ulong StakeE8s { get; set; } + + [CandidName("joined_community_fund_timestamp_seconds")] + public OptionalValue JoinedCommunityFundTimestampSeconds { get; set; } + + [CandidName("retrieved_at_timestamp_seconds")] + public ulong RetrievedAtTimestampSeconds { get; set; } + + [CandidName("known_neuron_data")] + public OptionalValue KnownNeuronData { get; set; } + + [CandidName("voting_power")] + public ulong VotingPower { get; set; } + + [CandidName("age_seconds")] + public ulong AgeSeconds { get; set; } + + public NeuronInfo(ulong dissolveDelaySeconds, List recentBallots, ulong createdTimestampSeconds, int state, ulong stakeE8s, OptionalValue joinedCommunityFundTimestampSeconds, ulong retrievedAtTimestampSeconds, OptionalValue knownNeuronData, ulong votingPower, ulong ageSeconds) + { + this.DissolveDelaySeconds = dissolveDelaySeconds; + this.RecentBallots = recentBallots; + this.CreatedTimestampSeconds = createdTimestampSeconds; + this.State = state; + this.StakeE8s = stakeE8s; + this.JoinedCommunityFundTimestampSeconds = joinedCommunityFundTimestampSeconds; + this.RetrievedAtTimestampSeconds = retrievedAtTimestampSeconds; + this.KnownNeuronData = knownNeuronData; + this.VotingPower = votingPower; + this.AgeSeconds = ageSeconds; + } + + public NeuronInfo() + { + } + } +} + +Type File: 'NeuronStakeTransfer' + +using EdjCase.ICP.Candid.Mapping; +using System.Collections.Generic; +using EdjCase.ICP.Candid.Models; + +namespace Test.Models +{ + public class NeuronStakeTransfer + { + [CandidName("to_subaccount")] + public List ToSubaccount { get; set; } + + [CandidName("neuron_stake_e8s")] + public ulong NeuronStakeE8s { get; set; } + + [CandidName("from")] + public OptionalValue From { get; set; } + + [CandidName("memo")] + public ulong Memo { get; set; } + + [CandidName("from_subaccount")] + public List FromSubaccount { get; set; } + + [CandidName("transfer_timestamp")] + public ulong TransferTimestamp { get; set; } + + [CandidName("block_height")] + public ulong BlockHeight { get; set; } + + public NeuronStakeTransfer(List toSubaccount, ulong neuronStakeE8s, OptionalValue from, ulong memo, List fromSubaccount, ulong transferTimestamp, ulong blockHeight) + { + this.ToSubaccount = toSubaccount; + this.NeuronStakeE8s = neuronStakeE8s; + this.From = from; + this.Memo = memo; + this.FromSubaccount = fromSubaccount; + this.TransferTimestamp = transferTimestamp; + this.BlockHeight = blockHeight; + } + + public NeuronStakeTransfer() + { + } + } +} + +Type File: 'NodeProvider' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class NodeProvider + { + [CandidName("id")] + public OptionalValue Id { get; set; } + + [CandidName("reward_account")] + public OptionalValue RewardAccount { get; set; } + + public NodeProvider(OptionalValue id, OptionalValue rewardAccount) + { + this.Id = id; + this.RewardAccount = rewardAccount; + } + + public NodeProvider() + { + } + } +} + +Type File: 'Operation' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; + +namespace Test.Models +{ + [Variant()] + public class Operation + { + [VariantTagProperty()] + public OperationTag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public RemoveHotKey? RemoveHotKey { get => this.Tag == OperationTag.RemoveHotKey ? (RemoveHotKey)this.Value! : default; set => (this.Tag, this.Value) = (OperationTag.RemoveHotKey, value); } + + public AddHotKey? AddHotKey { get => this.Tag == OperationTag.AddHotKey ? (AddHotKey)this.Value! : default; set => (this.Tag, this.Value) = (OperationTag.AddHotKey, value); } + + public Operation.StopDissolvingInfo? StopDissolving { get => this.Tag == OperationTag.StopDissolving ? (Operation.StopDissolvingInfo)this.Value! : default; set => (this.Tag, this.Value) = (OperationTag.StopDissolving, value); } + + public Operation.StartDissolvingInfo? StartDissolving { get => this.Tag == OperationTag.StartDissolving ? (Operation.StartDissolvingInfo)this.Value! : default; set => (this.Tag, this.Value) = (OperationTag.StartDissolving, value); } + + public IncreaseDissolveDelay? IncreaseDissolveDelay { get => this.Tag == OperationTag.IncreaseDissolveDelay ? (IncreaseDissolveDelay)this.Value! : default; set => (this.Tag, this.Value) = (OperationTag.IncreaseDissolveDelay, value); } + + public Operation.JoinCommunityFundInfo? JoinCommunityFund { get => this.Tag == OperationTag.JoinCommunityFund ? (Operation.JoinCommunityFundInfo)this.Value! : default; set => (this.Tag, this.Value) = (OperationTag.JoinCommunityFund, value); } + + public SetDissolveTimestamp? SetDissolveTimestamp { get => this.Tag == OperationTag.SetDissolveTimestamp ? (SetDissolveTimestamp)this.Value! : default; set => (this.Tag, this.Value) = (OperationTag.SetDissolveTimestamp, value); } + + public Operation(OperationTag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected Operation() + { + } + + public class StopDissolvingInfo + { + public StopDissolvingInfo() + { + } + } + + public class StartDissolvingInfo + { + public StartDissolvingInfo() + { + } + } + + public class JoinCommunityFundInfo + { + public JoinCommunityFundInfo() + { + } + } + } + + public enum OperationTag + { + RemoveHotKey, + AddHotKey, + StopDissolving, + StartDissolving, + IncreaseDissolveDelay, + JoinCommunityFund, + SetDissolveTimestamp + } +} + +Type File: 'Proposal' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class Proposal + { + [CandidName("url")] + public string Url { get; set; } + + [CandidName("title")] + public OptionalValue Title { get; set; } + + [CandidName("action")] + public OptionalValue Action { get; set; } + + [CandidName("summary")] + public string Summary { get; set; } + + public Proposal(string url, OptionalValue title, OptionalValue action, string summary) + { + this.Url = url; + this.Title = title; + this.Action = action; + this.Summary = summary; + } + + public Proposal() + { + } + } +} + +Type File: 'ProposalData' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test.Models; +using System.Collections.Generic; + +namespace Test.Models +{ + public class ProposalData + { + [CandidName("id")] + public OptionalValue Id { get; set; } + + [CandidName("failure_reason")] + public OptionalValue FailureReason { get; set; } + + [CandidName("ballots")] + public Dictionary Ballots { get; set; } + + [CandidName("proposal_timestamp_seconds")] + public ulong ProposalTimestampSeconds { get; set; } + + [CandidName("reward_event_round")] + public ulong RewardEventRound { get; set; } + + [CandidName("failed_timestamp_seconds")] + public ulong FailedTimestampSeconds { get; set; } + + [CandidName("reject_cost_e8s")] + public ulong RejectCostE8s { get; set; } + + [CandidName("latest_tally")] + public OptionalValue LatestTally { get; set; } + + [CandidName("decided_timestamp_seconds")] + public ulong DecidedTimestampSeconds { get; set; } + + [CandidName("proposal")] + public OptionalValue Proposal { get; set; } + + [CandidName("proposer")] + public OptionalValue Proposer { get; set; } + + [CandidName("wait_for_quiet_state")] + public OptionalValue WaitForQuietState { get; set; } + + [CandidName("executed_timestamp_seconds")] + public ulong ExecutedTimestampSeconds { get; set; } + + public ProposalData(OptionalValue id, OptionalValue failureReason, Dictionary ballots, ulong proposalTimestampSeconds, ulong rewardEventRound, ulong failedTimestampSeconds, ulong rejectCostE8s, OptionalValue latestTally, ulong decidedTimestampSeconds, OptionalValue proposal, OptionalValue proposer, OptionalValue waitForQuietState, ulong executedTimestampSeconds) + { + this.Id = id; + this.FailureReason = failureReason; + this.Ballots = ballots; + this.ProposalTimestampSeconds = proposalTimestampSeconds; + this.RewardEventRound = rewardEventRound; + this.FailedTimestampSeconds = failedTimestampSeconds; + this.RejectCostE8s = rejectCostE8s; + this.LatestTally = latestTally; + this.DecidedTimestampSeconds = decidedTimestampSeconds; + this.Proposal = proposal; + this.Proposer = proposer; + this.WaitForQuietState = waitForQuietState; + this.ExecutedTimestampSeconds = executedTimestampSeconds; + } + + public ProposalData() + { + } + } +} + +Type File: 'ProposalInfo' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test.Models; +using System.Collections.Generic; + +namespace Test.Models +{ + public class ProposalInfo + { + [CandidName("id")] + public OptionalValue Id { get; set; } + + [CandidName("status")] + public int Status { get; set; } + + [CandidName("topic")] + public int Topic { get; set; } + + [CandidName("failure_reason")] + public OptionalValue FailureReason { get; set; } + + [CandidName("ballots")] + public Dictionary Ballots { get; set; } + + [CandidName("proposal_timestamp_seconds")] + public ulong ProposalTimestampSeconds { get; set; } + + [CandidName("reward_event_round")] + public ulong RewardEventRound { get; set; } + + [CandidName("deadline_timestamp_seconds")] + public OptionalValue DeadlineTimestampSeconds { get; set; } + + [CandidName("failed_timestamp_seconds")] + public ulong FailedTimestampSeconds { get; set; } + + [CandidName("reject_cost_e8s")] + public ulong RejectCostE8s { get; set; } + + [CandidName("latest_tally")] + public OptionalValue LatestTally { get; set; } + + [CandidName("reward_status")] + public int RewardStatus { get; set; } + + [CandidName("decided_timestamp_seconds")] + public ulong DecidedTimestampSeconds { get; set; } + + [CandidName("proposal")] + public OptionalValue Proposal { get; set; } + + [CandidName("proposer")] + public OptionalValue Proposer { get; set; } + + [CandidName("executed_timestamp_seconds")] + public ulong ExecutedTimestampSeconds { get; set; } + + public ProposalInfo(OptionalValue id, int status, int topic, OptionalValue failureReason, Dictionary ballots, ulong proposalTimestampSeconds, ulong rewardEventRound, OptionalValue deadlineTimestampSeconds, ulong failedTimestampSeconds, ulong rejectCostE8s, OptionalValue latestTally, int rewardStatus, ulong decidedTimestampSeconds, OptionalValue proposal, OptionalValue proposer, ulong executedTimestampSeconds) + { + this.Id = id; + this.Status = status; + this.Topic = topic; + this.FailureReason = failureReason; + this.Ballots = ballots; + this.ProposalTimestampSeconds = proposalTimestampSeconds; + this.RewardEventRound = rewardEventRound; + this.DeadlineTimestampSeconds = deadlineTimestampSeconds; + this.FailedTimestampSeconds = failedTimestampSeconds; + this.RejectCostE8s = rejectCostE8s; + this.LatestTally = latestTally; + this.RewardStatus = rewardStatus; + this.DecidedTimestampSeconds = decidedTimestampSeconds; + this.Proposal = proposal; + this.Proposer = proposer; + this.ExecutedTimestampSeconds = executedTimestampSeconds; + } + + public ProposalInfo() + { + } + } +} + +Type File: 'RegisterVote' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class RegisterVote + { + [CandidName("vote")] + public int Vote { get; set; } + + [CandidName("proposal")] + public OptionalValue Proposal { get; set; } + + public RegisterVote(int vote, OptionalValue proposal) + { + this.Vote = vote; + this.Proposal = proposal; + } + + public RegisterVote() + { + } + } +} + +Type File: 'RemoveHotKey' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; + +namespace Test.Models +{ + public class RemoveHotKey + { + [CandidName("hot_key_to_remove")] + public OptionalValue HotKeyToRemove { get; set; } + + public RemoveHotKey(OptionalValue hotKeyToRemove) + { + this.HotKeyToRemove = hotKeyToRemove; + } + + public RemoveHotKey() + { + } + } +} + +Type File: 'Result' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; + +namespace Test.Models +{ + [Variant()] + public class Result + { + [VariantTagProperty()] + public ResultTag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public GovernanceError? Err { get => this.Tag == ResultTag.Err ? (GovernanceError)this.Value! : default; set => (this.Tag, this.Value) = (ResultTag.Err, value); } + + public Result(ResultTag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected Result() + { + } + } + + public enum ResultTag + { + Ok, + Err + } +} + +Type File: 'Result1' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; + +namespace Test.Models +{ + [Variant()] + public class Result1 + { + [VariantTagProperty()] + public Result1Tag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public GovernanceError? Error { get => this.Tag == Result1Tag.Error ? (GovernanceError)this.Value! : default; set => (this.Tag, this.Value) = (Result1Tag.Error, value); } + + public NeuronId? NeuronId { get => this.Tag == Result1Tag.NeuronId ? (NeuronId)this.Value! : default; set => (this.Tag, this.Value) = (Result1Tag.NeuronId, value); } + + public Result1(Result1Tag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected Result1() + { + } + } + + public enum Result1Tag + { + Error, + NeuronId + } +} + +Type File: 'Result2' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; + +namespace Test.Models +{ + [Variant()] + public class Result2 + { + [VariantTagProperty()] + public Result2Tag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public Neuron? Ok { get => this.Tag == Result2Tag.Ok ? (Neuron)this.Value! : default; set => (this.Tag, this.Value) = (Result2Tag.Ok, value); } + + public GovernanceError? Err { get => this.Tag == Result2Tag.Err ? (GovernanceError)this.Value! : default; set => (this.Tag, this.Value) = (Result2Tag.Err, value); } + + public Result2(Result2Tag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected Result2() + { + } + } + + public enum Result2Tag + { + Ok, + Err + } +} + +Type File: 'Result3' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; + +namespace Test.Models +{ + [Variant()] + public class Result3 + { + [VariantTagProperty()] + public Result3Tag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public RewardNodeProviders? Ok { get => this.Tag == Result3Tag.Ok ? (RewardNodeProviders)this.Value! : default; set => (this.Tag, this.Value) = (Result3Tag.Ok, value); } + + public GovernanceError? Err { get => this.Tag == Result3Tag.Err ? (GovernanceError)this.Value! : default; set => (this.Tag, this.Value) = (Result3Tag.Err, value); } + + public Result3(Result3Tag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected Result3() + { + } + } + + public enum Result3Tag + { + Ok, + Err + } +} + +Type File: 'Result4' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; + +namespace Test.Models +{ + [Variant()] + public class Result4 + { + [VariantTagProperty()] + public Result4Tag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public NeuronInfo? Ok { get => this.Tag == Result4Tag.Ok ? (NeuronInfo)this.Value! : default; set => (this.Tag, this.Value) = (Result4Tag.Ok, value); } + + public GovernanceError? Err { get => this.Tag == Result4Tag.Err ? (GovernanceError)this.Value! : default; set => (this.Tag, this.Value) = (Result4Tag.Err, value); } + + public Result4(Result4Tag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected Result4() + { + } + } + + public enum Result4Tag + { + Ok, + Err + } +} + +Type File: 'Result5' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; + +namespace Test.Models +{ + [Variant()] + public class Result5 + { + [VariantTagProperty()] + public Result5Tag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public NodeProvider? Ok { get => this.Tag == Result5Tag.Ok ? (NodeProvider)this.Value! : default; set => (this.Tag, this.Value) = (Result5Tag.Ok, value); } + + public GovernanceError? Err { get => this.Tag == Result5Tag.Err ? (GovernanceError)this.Value! : default; set => (this.Tag, this.Value) = (Result5Tag.Err, value); } + + public Result5(Result5Tag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected Result5() + { + } + } + + public enum Result5Tag + { + Ok, + Err + } +} + +Type File: 'RewardEvent' + +using EdjCase.ICP.Candid.Mapping; +using System.Collections.Generic; +using Test.Models; + +namespace Test.Models +{ + public class RewardEvent + { + [CandidName("day_after_genesis")] + public ulong DayAfterGenesis { get; set; } + + [CandidName("actual_timestamp_seconds")] + public ulong ActualTimestampSeconds { get; set; } + + [CandidName("distributed_e8s_equivalent")] + public ulong DistributedE8sEquivalent { get; set; } + + [CandidName("settled_proposals")] + public List SettledProposals { get; set; } + + public RewardEvent(ulong dayAfterGenesis, ulong actualTimestampSeconds, ulong distributedE8sEquivalent, List settledProposals) + { + this.DayAfterGenesis = dayAfterGenesis; + this.ActualTimestampSeconds = actualTimestampSeconds; + this.DistributedE8sEquivalent = distributedE8sEquivalent; + this.SettledProposals = settledProposals; + } + + public RewardEvent() + { + } + } +} + +Type File: 'RewardMode' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; + +namespace Test.Models +{ + [Variant()] + public class RewardMode + { + [VariantTagProperty()] + public RewardModeTag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public RewardToNeuron? RewardToNeuron { get => this.Tag == RewardModeTag.RewardToNeuron ? (RewardToNeuron)this.Value! : default; set => (this.Tag, this.Value) = (RewardModeTag.RewardToNeuron, value); } + + public RewardToAccount? RewardToAccount { get => this.Tag == RewardModeTag.RewardToAccount ? (RewardToAccount)this.Value! : default; set => (this.Tag, this.Value) = (RewardModeTag.RewardToAccount, value); } + + public RewardMode(RewardModeTag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected RewardMode() + { + } + } + + public enum RewardModeTag + { + RewardToNeuron, + RewardToAccount + } +} + +Type File: 'RewardNodeProvider' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class RewardNodeProvider + { + [CandidName("node_provider")] + public OptionalValue NodeProvider { get; set; } + + [CandidName("reward_mode")] + public OptionalValue RewardMode { get; set; } + + [CandidName("amount_e8s")] + public ulong AmountE8s { get; set; } + + public RewardNodeProvider(OptionalValue nodeProvider, OptionalValue rewardMode, ulong amountE8s) + { + this.NodeProvider = nodeProvider; + this.RewardMode = rewardMode; + this.AmountE8s = amountE8s; + } + + public RewardNodeProvider() + { + } + } +} + +Type File: 'RewardNodeProviders' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using System.Collections.Generic; +using Test.Models; + +namespace Test.Models +{ + public class RewardNodeProviders + { + [CandidName("use_registry_derived_rewards")] + public OptionalValue UseRegistryDerivedRewards { get; set; } + + [CandidName("rewards")] + public List Rewards { get; set; } + + public RewardNodeProviders(OptionalValue useRegistryDerivedRewards, List rewards) + { + this.UseRegistryDerivedRewards = useRegistryDerivedRewards; + this.Rewards = rewards; + } + + public RewardNodeProviders() + { + } + } +} + +Type File: 'RewardToAccount' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class RewardToAccount + { + [CandidName("to_account")] + public OptionalValue ToAccount { get; set; } + + public RewardToAccount(OptionalValue toAccount) + { + this.ToAccount = toAccount; + } + + public RewardToAccount() + { + } + } +} + +Type File: 'RewardToNeuron' + +using EdjCase.ICP.Candid.Mapping; + +namespace Test.Models +{ + public class RewardToNeuron + { + [CandidName("dissolve_delay_seconds")] + public ulong DissolveDelaySeconds { get; set; } + + public RewardToNeuron(ulong dissolveDelaySeconds) + { + this.DissolveDelaySeconds = dissolveDelaySeconds; + } + + public RewardToNeuron() + { + } + } +} + +Type File: 'SetDefaultFollowees' + +using EdjCase.ICP.Candid.Mapping; +using System.Collections.Generic; +using Test.Models; + +namespace Test.Models +{ + public class SetDefaultFollowees + { + [CandidName("default_followees")] + public Dictionary DefaultFollowees { get; set; } + + public SetDefaultFollowees(Dictionary defaultFollowees) + { + this.DefaultFollowees = defaultFollowees; + } + + public SetDefaultFollowees() + { + } + } +} + +Type File: 'SetDissolveTimestamp' + +using EdjCase.ICP.Candid.Mapping; + +namespace Test.Models +{ + public class SetDissolveTimestamp + { + [CandidName("dissolve_timestamp_seconds")] + public ulong DissolveTimestampSeconds { get; set; } + + public SetDissolveTimestamp(ulong dissolveTimestampSeconds) + { + this.DissolveTimestampSeconds = dissolveTimestampSeconds; + } + + public SetDissolveTimestamp() + { + } + } +} + +Type File: 'Spawn' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; + +namespace Test.Models +{ + public class Spawn + { + [CandidName("percentage_to_spawn")] + public OptionalValue PercentageToSpawn { get; set; } + + [CandidName("new_controller")] + public OptionalValue NewController { get; set; } + + [CandidName("nonce")] + public OptionalValue Nonce { get; set; } + + public Spawn(OptionalValue percentageToSpawn, OptionalValue newController, OptionalValue nonce) + { + this.PercentageToSpawn = percentageToSpawn; + this.NewController = newController; + this.Nonce = nonce; + } + + public Spawn() + { + } + } +} + +Type File: 'SpawnResponse' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class SpawnResponse + { + [CandidName("created_neuron_id")] + public OptionalValue CreatedNeuronId { get; set; } + + public SpawnResponse(OptionalValue createdNeuronId) + { + this.CreatedNeuronId = createdNeuronId; + } + + public SpawnResponse() + { + } + } +} + +Type File: 'Split' + +using EdjCase.ICP.Candid.Mapping; + +namespace Test.Models +{ + public class Split + { + [CandidName("amount_e8s")] + public ulong AmountE8s { get; set; } + + public Split(ulong amountE8s) + { + this.AmountE8s = amountE8s; + } + + public Split() + { + } + } +} + +Type File: 'Tally' + +using EdjCase.ICP.Candid.Mapping; + +namespace Test.Models +{ + public class Tally + { + [CandidName("no")] + public ulong No { get; set; } + + [CandidName("yes")] + public ulong Yes { get; set; } + + [CandidName("total")] + public ulong Total { get; set; } + + [CandidName("timestamp_seconds")] + public ulong TimestampSeconds { get; set; } + + public Tally(ulong no, ulong yes, ulong total, ulong timestampSeconds) + { + this.No = no; + this.Yes = yes; + this.Total = total; + this.TimestampSeconds = timestampSeconds; + } + + public Tally() + { + } + } +} + +Type File: 'UpdateNodeProvider' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class UpdateNodeProvider + { + [CandidName("reward_account")] + public OptionalValue RewardAccount { get; set; } + + public UpdateNodeProvider(OptionalValue rewardAccount) + { + this.RewardAccount = rewardAccount; + } + + public UpdateNodeProvider() + { + } + } +} + +Type File: 'WaitForQuietState' + +using EdjCase.ICP.Candid.Mapping; + +namespace Test.Models +{ + public class WaitForQuietState + { + [CandidName("current_deadline_timestamp_seconds")] + public ulong CurrentDeadlineTimestampSeconds { get; set; } + + public WaitForQuietState(ulong currentDeadlineTimestampSeconds) + { + this.CurrentDeadlineTimestampSeconds = currentDeadlineTimestampSeconds; + } + + public WaitForQuietState() + { + } + } +} diff --git a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_True_KeepCandidCase_True.snap b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False.snap similarity index 95% rename from test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_True_KeepCandidCase_True.snap rename to test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False.snap index 21dd66b2..82654955 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_True_KeepCandidCase_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False.snap @@ -208,7 +208,7 @@ using System; namespace Test.Models { - [Variant(typeof(ActionTag))] + [Variant()] public class Action { [VariantTagProperty()] @@ -348,25 +348,15 @@ namespace Test.Models public enum ActionTag { - [VariantOptionType(typeof(KnownNeuron))] RegisterKnownNeuron, - [VariantOptionType(typeof(ManageNeuron))] ManageNeuron, - [VariantOptionType(typeof(ExecuteNnsFunction))] ExecuteNnsFunction, - [VariantOptionType(typeof(RewardNodeProvider))] RewardNodeProvider, - [VariantOptionType(typeof(SetDefaultFollowees))] SetDefaultFollowees, - [VariantOptionType(typeof(RewardNodeProviders))] RewardNodeProviders, - [VariantOptionType(typeof(NetworkEconomics))] ManageNetworkEconomics, - [VariantOptionType(typeof(ApproveGenesisKyc))] ApproveGenesisKyc, - [VariantOptionType(typeof(AddOrRemoveNodeProvider))] AddOrRemoveNodeProvider, - [VariantOptionType(typeof(Motion))] Motion } } @@ -510,7 +500,7 @@ using System; namespace Test.Models { - [Variant(typeof(ByTag))] + [Variant()] public class By { [VariantTagProperty()] @@ -580,11 +570,8 @@ namespace Test.Models public enum ByTag { - [VariantOptionType(typeof(By.NeuronIdOrSubaccountInfo))] NeuronIdOrSubaccount, - [VariantOptionType(typeof(ClaimOrRefreshNeuronFromAccount))] MemoAndController, - [VariantOptionType(typeof(ulong))] Memo } } @@ -597,7 +584,7 @@ using System; namespace Test.Models { - [Variant(typeof(ChangeTag))] + [Variant()] public class Change { [VariantTagProperty()] @@ -649,9 +636,7 @@ namespace Test.Models public enum ChangeTag { - [VariantOptionType(typeof(NodeProvider))] ToRemove, - [VariantOptionType(typeof(NodeProvider))] ToAdd } } @@ -754,7 +739,7 @@ using System; namespace Test.Models { - [Variant(typeof(CommandTag))] + [Variant()] public class Command { [VariantTagProperty()] @@ -905,27 +890,16 @@ namespace Test.Models public enum CommandTag { - [VariantOptionType(typeof(Spawn))] Spawn, - [VariantOptionType(typeof(Split))] Split, - [VariantOptionType(typeof(Follow))] Follow, - [VariantOptionType(typeof(ClaimOrRefresh))] ClaimOrRefresh, - [VariantOptionType(typeof(Configure))] Configure, - [VariantOptionType(typeof(RegisterVote))] RegisterVote, - [VariantOptionType(typeof(Merge))] Merge, - [VariantOptionType(typeof(DisburseToNeuron))] DisburseToNeuron, - [VariantOptionType(typeof(Proposal))] MakeProposal, - [VariantOptionType(typeof(MergeMaturity))] MergeMaturity, - [VariantOptionType(typeof(Disburse))] Disburse } } @@ -938,7 +912,7 @@ using System; namespace Test.Models { - [Variant(typeof(Command_1Tag))] + [Variant()] public class Command_1 { [VariantTagProperty()] @@ -1128,29 +1102,17 @@ namespace Test.Models public enum Command_1Tag { - [VariantOptionType(typeof(GovernanceError))] Error, - [VariantOptionType(typeof(SpawnResponse))] Spawn, - [VariantOptionType(typeof(SpawnResponse))] Split, - [VariantOptionType(typeof(Command_1.FollowInfo))] Follow, - [VariantOptionType(typeof(ClaimOrRefreshResponse))] ClaimOrRefresh, - [VariantOptionType(typeof(Command_1.ConfigureInfo))] Configure, - [VariantOptionType(typeof(Command_1.RegisterVoteInfo))] RegisterVote, - [VariantOptionType(typeof(Command_1.MergeInfo))] Merge, - [VariantOptionType(typeof(SpawnResponse))] DisburseToNeuron, - [VariantOptionType(typeof(MakeProposalResponse))] MakeProposal, - [VariantOptionType(typeof(MergeMaturityResponse))] MergeMaturity, - [VariantOptionType(typeof(DisburseResponse))] Disburse } } @@ -1163,7 +1125,7 @@ using System; namespace Test.Models { - [Variant(typeof(Command_2Tag))] + [Variant()] public class Command_2 { [VariantTagProperty()] @@ -1281,21 +1243,13 @@ namespace Test.Models public enum Command_2Tag { - [VariantOptionType(typeof(Spawn))] Spawn, - [VariantOptionType(typeof(Split))] Split, - [VariantOptionType(typeof(Configure))] Configure, - [VariantOptionType(typeof(Merge))] Merge, - [VariantOptionType(typeof(DisburseToNeuron))] DisburseToNeuron, - [VariantOptionType(typeof(ClaimOrRefresh))] ClaimOrRefreshNeuron, - [VariantOptionType(typeof(MergeMaturity))] MergeMaturity, - [VariantOptionType(typeof(Disburse))] Disburse } } @@ -1407,7 +1361,7 @@ using System; namespace Test.Models { - [Variant(typeof(DissolveStateTag))] + [Variant()] public class DissolveState { [VariantTagProperty()] @@ -1459,9 +1413,7 @@ namespace Test.Models public enum DissolveStateTag { - [VariantOptionType(typeof(ulong))] DissolveDelaySeconds, - [VariantOptionType(typeof(ulong))] WhenDissolvedTimestampSeconds } } @@ -2192,7 +2144,7 @@ using System; namespace Test.Models { - [Variant(typeof(NeuronIdOrSubaccountTag))] + [Variant()] public class NeuronIdOrSubaccount { [VariantTagProperty()] @@ -2244,9 +2196,7 @@ namespace Test.Models public enum NeuronIdOrSubaccountTag { - [VariantOptionType(typeof(List))] Subaccount, - [VariantOptionType(typeof(NeuronId))] NeuronId } } @@ -2399,7 +2349,7 @@ using System; namespace Test.Models { - [Variant(typeof(OperationTag))] + [Variant()] public class Operation { [VariantTagProperty()] @@ -2527,19 +2477,12 @@ namespace Test.Models public enum OperationTag { - [VariantOptionType(typeof(RemoveHotKey))] RemoveHotKey, - [VariantOptionType(typeof(AddHotKey))] AddHotKey, - [VariantOptionType(typeof(Operation.StopDissolvingInfo))] StopDissolving, - [VariantOptionType(typeof(Operation.StartDissolvingInfo))] StartDissolving, - [VariantOptionType(typeof(IncreaseDissolveDelay))] IncreaseDissolveDelay, - [VariantOptionType(typeof(Operation.JoinCommunityFundInfo))] JoinCommunityFund, - [VariantOptionType(typeof(SetDissolveTimestamp))] SetDissolveTimestamp } } @@ -2756,7 +2699,7 @@ using System; namespace Test.Models { - [Variant(typeof(ResultTag))] + [Variant()] public class Result { [VariantTagProperty()] @@ -2803,7 +2746,6 @@ namespace Test.Models public enum ResultTag { Ok, - [VariantOptionType(typeof(GovernanceError))] Err } } @@ -2816,7 +2758,7 @@ using System; namespace Test.Models { - [Variant(typeof(Result_1Tag))] + [Variant()] public class Result_1 { [VariantTagProperty()] @@ -2868,9 +2810,7 @@ namespace Test.Models public enum Result_1Tag { - [VariantOptionType(typeof(GovernanceError))] Error, - [VariantOptionType(typeof(NeuronId))] NeuronId } } @@ -2883,7 +2823,7 @@ using System; namespace Test.Models { - [Variant(typeof(Result_2Tag))] + [Variant()] public class Result_2 { [VariantTagProperty()] @@ -2935,9 +2875,7 @@ namespace Test.Models public enum Result_2Tag { - [VariantOptionType(typeof(Neuron))] Ok, - [VariantOptionType(typeof(GovernanceError))] Err } } @@ -2950,7 +2888,7 @@ using System; namespace Test.Models { - [Variant(typeof(Result_3Tag))] + [Variant()] public class Result_3 { [VariantTagProperty()] @@ -3002,9 +2940,7 @@ namespace Test.Models public enum Result_3Tag { - [VariantOptionType(typeof(RewardNodeProviders))] Ok, - [VariantOptionType(typeof(GovernanceError))] Err } } @@ -3017,7 +2953,7 @@ using System; namespace Test.Models { - [Variant(typeof(Result_4Tag))] + [Variant()] public class Result_4 { [VariantTagProperty()] @@ -3069,9 +3005,7 @@ namespace Test.Models public enum Result_4Tag { - [VariantOptionType(typeof(NeuronInfo))] Ok, - [VariantOptionType(typeof(GovernanceError))] Err } } @@ -3084,7 +3018,7 @@ using System; namespace Test.Models { - [Variant(typeof(Result_5Tag))] + [Variant()] public class Result_5 { [VariantTagProperty()] @@ -3136,9 +3070,7 @@ namespace Test.Models public enum Result_5Tag { - [VariantOptionType(typeof(NodeProvider))] Ok, - [VariantOptionType(typeof(GovernanceError))] Err } } @@ -3182,7 +3114,7 @@ using System; namespace Test.Models { - [Variant(typeof(RewardModeTag))] + [Variant()] public class RewardMode { [VariantTagProperty()] @@ -3234,9 +3166,7 @@ namespace Test.Models public enum RewardModeTag { - [VariantOptionType(typeof(RewardToNeuron))] RewardToNeuron, - [VariantOptionType(typeof(RewardToAccount))] RewardToAccount } } diff --git a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True.snap b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True.snap new file mode 100644 index 00000000..7b4218b2 --- /dev/null +++ b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_False_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True.snap @@ -0,0 +1,2666 @@ +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 +{ + public class GovernanceApiClient + { + public IAgent Agent { get; } + + public Principal CanisterId { get; } + + public CandidConverter? Converter { get; } + + public GovernanceApiClient(IAgent agent, Principal canisterId, CandidConverter? converter = default) + { + this.Agent = agent; + this.CanisterId = canisterId; + this.Converter = converter; + } + + public async Task claim_gtc_neurons(Principal arg0, List arg1) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0), CandidTypedValue.FromObject(arg1)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "claim_gtc_neurons", arg); + return reply.ToObjects(this.Converter); + } + + public async Task claim_or_refresh_neuron_from_account(Models.ClaimOrRefreshNeuronFromAccount arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "claim_or_refresh_neuron_from_account", arg); + return reply.ToObjects(this.Converter); + } + + 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(); + return reply.ToObjects(this.Converter); + } + + public async Task _get_full_neuron(ulong arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron", arg); + CandidArg reply = response.ThrowOrGetReply(); + 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)); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron_by_id_or_subaccount", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + + public async Task _get_monthly_node_provider_rewards() + { + CandidArg arg = CandidArg.FromCandid(); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "get_monthly_node_provider_rewards", arg); + return reply.ToObjects(this.Converter); + } + + 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(); + 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(); + return reply.ToObjects>(this.Converter); + } + + public async Task _get_neuron_info(ulong arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info", arg); + CandidArg reply = response.ThrowOrGetReply(); + 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)); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info_by_id_or_subaccount", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + + public async Task _get_node_provider_by_caller(NullValue arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_node_provider_by_caller", arg); + CandidArg reply = response.ThrowOrGetReply(); + 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(); + return reply.ToObjects>(this.Converter); + } + + public async Task> _get_proposal_info(ulong arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_proposal_info", arg); + CandidArg reply = response.ThrowOrGetReply(); + 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(); + return reply.ToObjects(this.Converter); + } + + public async Task list_neurons(Models.ListNeurons arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_neurons", arg); + CandidArg reply = response.ThrowOrGetReply(); + 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(); + return reply.ToObjects(this.Converter); + } + + public async Task list_proposals(Models.ListProposalInfo arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_proposals", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + + public async Task manage_neuron(Models.ManageNeuron arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "manage_neuron", arg); + return reply.ToObjects(this.Converter); + } + + public async Task transfer_gtc_neuron(Models.NeuronId arg0, Models.NeuronId arg1) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0), CandidTypedValue.FromObject(arg1)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "transfer_gtc_neuron", arg); + return reply.ToObjects(this.Converter); + } + + public async Task update_node_provider(Models.UpdateNodeProvider arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "update_node_provider", arg); + return reply.ToObjects(this.Converter); + } + } +} + +Type File: 'AccountIdentifier' + +using System.Collections.Generic; + +namespace Test.Models +{ + public class AccountIdentifier + { + public List hash { get; set; } + + public AccountIdentifier(List hash) + { + this.hash = hash; + } + + public AccountIdentifier() + { + } + } +} + +Type File: 'Action' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; + +namespace Test.Models +{ + [Variant()] + public class Action + { + [VariantTagProperty()] + public ActionTag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public KnownNeuron? RegisterKnownNeuron { get => this.Tag == ActionTag.RegisterKnownNeuron ? (KnownNeuron)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.RegisterKnownNeuron, value); } + + public ManageNeuron? ManageNeuron { get => this.Tag == ActionTag.ManageNeuron ? (ManageNeuron)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.ManageNeuron, value); } + + public ExecuteNnsFunction? ExecuteNnsFunction { get => this.Tag == ActionTag.ExecuteNnsFunction ? (ExecuteNnsFunction)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.ExecuteNnsFunction, value); } + + public RewardNodeProvider? RewardNodeProvider { get => this.Tag == ActionTag.RewardNodeProvider ? (RewardNodeProvider)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.RewardNodeProvider, value); } + + public SetDefaultFollowees? SetDefaultFollowees { get => this.Tag == ActionTag.SetDefaultFollowees ? (SetDefaultFollowees)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.SetDefaultFollowees, value); } + + public RewardNodeProviders? RewardNodeProviders { get => this.Tag == ActionTag.RewardNodeProviders ? (RewardNodeProviders)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.RewardNodeProviders, value); } + + public NetworkEconomics? ManageNetworkEconomics { get => this.Tag == ActionTag.ManageNetworkEconomics ? (NetworkEconomics)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.ManageNetworkEconomics, value); } + + public ApproveGenesisKyc? ApproveGenesisKyc { get => this.Tag == ActionTag.ApproveGenesisKyc ? (ApproveGenesisKyc)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.ApproveGenesisKyc, value); } + + public AddOrRemoveNodeProvider? AddOrRemoveNodeProvider { get => this.Tag == ActionTag.AddOrRemoveNodeProvider ? (AddOrRemoveNodeProvider)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.AddOrRemoveNodeProvider, value); } + + public Motion? Motion { get => this.Tag == ActionTag.Motion ? (Motion)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.Motion, value); } + + public Action(ActionTag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected Action() + { + } + } + + public enum ActionTag + { + RegisterKnownNeuron, + ManageNeuron, + ExecuteNnsFunction, + RewardNodeProvider, + SetDefaultFollowees, + RewardNodeProviders, + ManageNetworkEconomics, + ApproveGenesisKyc, + AddOrRemoveNodeProvider, + Motion + } +} + +Type File: 'AddHotKey' + +using EdjCase.ICP.Candid.Models; + +namespace Test.Models +{ + public class AddHotKey + { + public OptionalValue new_hot_key { get; set; } + + public AddHotKey(OptionalValue newHotKey) + { + this.new_hot_key = newHotKey; + } + + public AddHotKey() + { + } + } +} + +Type File: 'AddOrRemoveNodeProvider' + +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class AddOrRemoveNodeProvider + { + public OptionalValue change { get; set; } + + public AddOrRemoveNodeProvider(OptionalValue change) + { + this.change = change; + } + + public AddOrRemoveNodeProvider() + { + } + } +} + +Type File: 'Amount' + +namespace Test.Models +{ + public class Amount + { + public ulong e8s { get; set; } + + public Amount(ulong e8s) + { + this.e8s = e8s; + } + + public Amount() + { + } + } +} + +Type File: 'ApproveGenesisKyc' + +using System.Collections.Generic; +using EdjCase.ICP.Candid.Models; + +namespace Test.Models +{ + public class ApproveGenesisKyc + { + public List principals { get; set; } + + public ApproveGenesisKyc(List principals) + { + this.principals = principals; + } + + public ApproveGenesisKyc() + { + } + } +} + +Type File: 'Ballot' + +namespace Test.Models +{ + public class Ballot + { + public int vote { get; set; } + + public ulong voting_power { get; set; } + + public Ballot(int vote, ulong votingPower) + { + this.vote = vote; + this.voting_power = votingPower; + } + + public Ballot() + { + } + } +} + +Type File: 'BallotInfo' + +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class BallotInfo + { + public int vote { get; set; } + + public OptionalValue proposal_id { get; set; } + + public BallotInfo(int vote, OptionalValue proposalId) + { + this.vote = vote; + this.proposal_id = proposalId; + } + + public BallotInfo() + { + } + } +} + +Type File: 'By' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; + +namespace Test.Models +{ + [Variant()] + public class By + { + [VariantTagProperty()] + public ByTag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public By.NeuronIdOrSubaccountInfo? NeuronIdOrSubaccount { get => this.Tag == ByTag.NeuronIdOrSubaccount ? (By.NeuronIdOrSubaccountInfo)this.Value! : default; set => (this.Tag, this.Value) = (ByTag.NeuronIdOrSubaccount, value); } + + public ClaimOrRefreshNeuronFromAccount? MemoAndController { get => this.Tag == ByTag.MemoAndController ? (ClaimOrRefreshNeuronFromAccount)this.Value! : default; set => (this.Tag, this.Value) = (ByTag.MemoAndController, value); } + + public ulong? Memo { get => this.Tag == ByTag.Memo ? (ulong)this.Value! : default; set => (this.Tag, this.Value) = (ByTag.Memo, value); } + + public By(ByTag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected By() + { + } + + public class NeuronIdOrSubaccountInfo + { + public NeuronIdOrSubaccountInfo() + { + } + } + } + + public enum ByTag + { + NeuronIdOrSubaccount, + MemoAndController, + Memo + } +} + +Type File: 'Change' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; + +namespace Test.Models +{ + [Variant()] + public class Change + { + [VariantTagProperty()] + public ChangeTag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public NodeProvider? ToRemove { get => this.Tag == ChangeTag.ToRemove ? (NodeProvider)this.Value! : default; set => (this.Tag, this.Value) = (ChangeTag.ToRemove, value); } + + public NodeProvider? ToAdd { get => this.Tag == ChangeTag.ToAdd ? (NodeProvider)this.Value! : default; set => (this.Tag, this.Value) = (ChangeTag.ToAdd, value); } + + public Change(ChangeTag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected Change() + { + } + } + + public enum ChangeTag + { + ToRemove, + ToAdd + } +} + +Type File: 'ClaimOrRefresh' + +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class ClaimOrRefresh + { + public OptionalValue by { get; set; } + + public ClaimOrRefresh(OptionalValue by) + { + this.by = by; + } + + public ClaimOrRefresh() + { + } + } +} + +Type File: 'ClaimOrRefreshNeuronFromAccount' + +using EdjCase.ICP.Candid.Models; + +namespace Test.Models +{ + public class ClaimOrRefreshNeuronFromAccount + { + public OptionalValue controller { get; set; } + + public ulong memo { get; set; } + + public ClaimOrRefreshNeuronFromAccount(OptionalValue controller, ulong memo) + { + this.controller = controller; + this.memo = memo; + } + + public ClaimOrRefreshNeuronFromAccount() + { + } + } +} + +Type File: 'ClaimOrRefreshNeuronFromAccountResponse' + +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class ClaimOrRefreshNeuronFromAccountResponse + { + public OptionalValue result { get; set; } + + public ClaimOrRefreshNeuronFromAccountResponse(OptionalValue result) + { + this.result = result; + } + + public ClaimOrRefreshNeuronFromAccountResponse() + { + } + } +} + +Type File: 'ClaimOrRefreshResponse' + +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class ClaimOrRefreshResponse + { + public OptionalValue refreshed_neuron_id { get; set; } + + public ClaimOrRefreshResponse(OptionalValue refreshedNeuronId) + { + this.refreshed_neuron_id = refreshedNeuronId; + } + + public ClaimOrRefreshResponse() + { + } + } +} + +Type File: 'Command' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; + +namespace Test.Models +{ + [Variant()] + public class Command + { + [VariantTagProperty()] + public CommandTag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public Spawn? Spawn { get => this.Tag == CommandTag.Spawn ? (Spawn)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.Spawn, value); } + + public Split? Split { get => this.Tag == CommandTag.Split ? (Split)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.Split, value); } + + public Follow? Follow { get => this.Tag == CommandTag.Follow ? (Follow)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.Follow, value); } + + public ClaimOrRefresh? ClaimOrRefresh { get => this.Tag == CommandTag.ClaimOrRefresh ? (ClaimOrRefresh)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.ClaimOrRefresh, value); } + + public Configure? Configure { get => this.Tag == CommandTag.Configure ? (Configure)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.Configure, value); } + + public RegisterVote? RegisterVote { get => this.Tag == CommandTag.RegisterVote ? (RegisterVote)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.RegisterVote, value); } + + public Merge? Merge { get => this.Tag == CommandTag.Merge ? (Merge)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.Merge, value); } + + public DisburseToNeuron? DisburseToNeuron { get => this.Tag == CommandTag.DisburseToNeuron ? (DisburseToNeuron)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.DisburseToNeuron, value); } + + public Proposal? MakeProposal { get => this.Tag == CommandTag.MakeProposal ? (Proposal)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.MakeProposal, value); } + + public MergeMaturity? MergeMaturity { get => this.Tag == CommandTag.MergeMaturity ? (MergeMaturity)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.MergeMaturity, value); } + + public Disburse? Disburse { get => this.Tag == CommandTag.Disburse ? (Disburse)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.Disburse, value); } + + public Command(CommandTag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected Command() + { + } + } + + public enum CommandTag + { + Spawn, + Split, + Follow, + ClaimOrRefresh, + Configure, + RegisterVote, + Merge, + DisburseToNeuron, + MakeProposal, + MergeMaturity, + Disburse + } +} + +Type File: 'Command_1' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; + +namespace Test.Models +{ + [Variant()] + public class Command_1 + { + [VariantTagProperty()] + public Command_1Tag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public GovernanceError? Error { get => this.Tag == Command_1Tag.Error ? (GovernanceError)this.Value! : default; set => (this.Tag, this.Value) = (Command_1Tag.Error, value); } + + public SpawnResponse? Spawn { get => this.Tag == Command_1Tag.Spawn ? (SpawnResponse)this.Value! : default; set => (this.Tag, this.Value) = (Command_1Tag.Spawn, value); } + + public SpawnResponse? Split { get => this.Tag == Command_1Tag.Split ? (SpawnResponse)this.Value! : default; set => (this.Tag, this.Value) = (Command_1Tag.Split, value); } + + public Command_1.FollowInfo? Follow { get => this.Tag == Command_1Tag.Follow ? (Command_1.FollowInfo)this.Value! : default; set => (this.Tag, this.Value) = (Command_1Tag.Follow, value); } + + public ClaimOrRefreshResponse? ClaimOrRefresh { get => this.Tag == Command_1Tag.ClaimOrRefresh ? (ClaimOrRefreshResponse)this.Value! : default; set => (this.Tag, this.Value) = (Command_1Tag.ClaimOrRefresh, value); } + + public Command_1.ConfigureInfo? Configure { get => this.Tag == Command_1Tag.Configure ? (Command_1.ConfigureInfo)this.Value! : default; set => (this.Tag, this.Value) = (Command_1Tag.Configure, value); } + + public Command_1.RegisterVoteInfo? RegisterVote { get => this.Tag == Command_1Tag.RegisterVote ? (Command_1.RegisterVoteInfo)this.Value! : default; set => (this.Tag, this.Value) = (Command_1Tag.RegisterVote, value); } + + public Command_1.MergeInfo? Merge { get => this.Tag == Command_1Tag.Merge ? (Command_1.MergeInfo)this.Value! : default; set => (this.Tag, this.Value) = (Command_1Tag.Merge, value); } + + public SpawnResponse? DisburseToNeuron { get => this.Tag == Command_1Tag.DisburseToNeuron ? (SpawnResponse)this.Value! : default; set => (this.Tag, this.Value) = (Command_1Tag.DisburseToNeuron, value); } + + public MakeProposalResponse? MakeProposal { get => this.Tag == Command_1Tag.MakeProposal ? (MakeProposalResponse)this.Value! : default; set => (this.Tag, this.Value) = (Command_1Tag.MakeProposal, value); } + + public MergeMaturityResponse? MergeMaturity { get => this.Tag == Command_1Tag.MergeMaturity ? (MergeMaturityResponse)this.Value! : default; set => (this.Tag, this.Value) = (Command_1Tag.MergeMaturity, value); } + + public DisburseResponse? Disburse { get => this.Tag == Command_1Tag.Disburse ? (DisburseResponse)this.Value! : default; set => (this.Tag, this.Value) = (Command_1Tag.Disburse, value); } + + public Command_1(Command_1Tag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected Command_1() + { + } + + public class FollowInfo + { + public FollowInfo() + { + } + } + + public class ConfigureInfo + { + public ConfigureInfo() + { + } + } + + public class RegisterVoteInfo + { + public RegisterVoteInfo() + { + } + } + + public class MergeInfo + { + public MergeInfo() + { + } + } + } + + public enum Command_1Tag + { + Error, + Spawn, + Split, + Follow, + ClaimOrRefresh, + Configure, + RegisterVote, + Merge, + DisburseToNeuron, + MakeProposal, + MergeMaturity, + Disburse + } +} + +Type File: 'Command_2' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; + +namespace Test.Models +{ + [Variant()] + public class Command_2 + { + [VariantTagProperty()] + public Command_2Tag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public Spawn? Spawn { get => this.Tag == Command_2Tag.Spawn ? (Spawn)this.Value! : default; set => (this.Tag, this.Value) = (Command_2Tag.Spawn, value); } + + public Split? Split { get => this.Tag == Command_2Tag.Split ? (Split)this.Value! : default; set => (this.Tag, this.Value) = (Command_2Tag.Split, value); } + + public Configure? Configure { get => this.Tag == Command_2Tag.Configure ? (Configure)this.Value! : default; set => (this.Tag, this.Value) = (Command_2Tag.Configure, value); } + + public Merge? Merge { get => this.Tag == Command_2Tag.Merge ? (Merge)this.Value! : default; set => (this.Tag, this.Value) = (Command_2Tag.Merge, value); } + + public DisburseToNeuron? DisburseToNeuron { get => this.Tag == Command_2Tag.DisburseToNeuron ? (DisburseToNeuron)this.Value! : default; set => (this.Tag, this.Value) = (Command_2Tag.DisburseToNeuron, value); } + + public ClaimOrRefresh? ClaimOrRefreshNeuron { get => this.Tag == Command_2Tag.ClaimOrRefreshNeuron ? (ClaimOrRefresh)this.Value! : default; set => (this.Tag, this.Value) = (Command_2Tag.ClaimOrRefreshNeuron, value); } + + public MergeMaturity? MergeMaturity { get => this.Tag == Command_2Tag.MergeMaturity ? (MergeMaturity)this.Value! : default; set => (this.Tag, this.Value) = (Command_2Tag.MergeMaturity, value); } + + public Disburse? Disburse { get => this.Tag == Command_2Tag.Disburse ? (Disburse)this.Value! : default; set => (this.Tag, this.Value) = (Command_2Tag.Disburse, value); } + + public Command_2(Command_2Tag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected Command_2() + { + } + } + + public enum Command_2Tag + { + Spawn, + Split, + Configure, + Merge, + DisburseToNeuron, + ClaimOrRefreshNeuron, + MergeMaturity, + Disburse + } +} + +Type File: 'Configure' + +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class Configure + { + public OptionalValue operation { get; set; } + + public Configure(OptionalValue operation) + { + this.operation = operation; + } + + public Configure() + { + } + } +} + +Type File: 'Disburse' + +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class Disburse + { + public OptionalValue to_account { get; set; } + + public OptionalValue amount { get; set; } + + public Disburse(OptionalValue toAccount, OptionalValue amount) + { + this.to_account = toAccount; + this.amount = amount; + } + + public Disburse() + { + } + } +} + +Type File: 'DisburseResponse' + +namespace Test.Models +{ + public class DisburseResponse + { + public ulong transfer_block_height { get; set; } + + public DisburseResponse(ulong transferBlockHeight) + { + this.transfer_block_height = transferBlockHeight; + } + + public DisburseResponse() + { + } + } +} + +Type File: 'DisburseToNeuron' + +using EdjCase.ICP.Candid.Models; + +namespace Test.Models +{ + public class DisburseToNeuron + { + public ulong dissolve_delay_seconds { get; set; } + + public bool kyc_verified { get; set; } + + public ulong amount_e8s { get; set; } + + public OptionalValue new_controller { get; set; } + + public ulong nonce { get; set; } + + public DisburseToNeuron(ulong dissolveDelaySeconds, bool kycVerified, ulong amountE8s, OptionalValue newController, ulong nonce) + { + this.dissolve_delay_seconds = dissolveDelaySeconds; + this.kyc_verified = kycVerified; + this.amount_e8s = amountE8s; + this.new_controller = newController; + this.nonce = nonce; + } + + public DisburseToNeuron() + { + } + } +} + +Type File: 'DissolveState' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; + +namespace Test.Models +{ + [Variant()] + public class DissolveState + { + [VariantTagProperty()] + public DissolveStateTag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public ulong? DissolveDelaySeconds { get => this.Tag == DissolveStateTag.DissolveDelaySeconds ? (ulong)this.Value! : default; set => (this.Tag, this.Value) = (DissolveStateTag.DissolveDelaySeconds, value); } + + public ulong? WhenDissolvedTimestampSeconds { get => this.Tag == DissolveStateTag.WhenDissolvedTimestampSeconds ? (ulong)this.Value! : default; set => (this.Tag, this.Value) = (DissolveStateTag.WhenDissolvedTimestampSeconds, value); } + + public DissolveState(DissolveStateTag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected DissolveState() + { + } + } + + public enum DissolveStateTag + { + DissolveDelaySeconds, + WhenDissolvedTimestampSeconds + } +} + +Type File: 'ExecuteNnsFunction' + +using System.Collections.Generic; + +namespace Test.Models +{ + public class ExecuteNnsFunction + { + public int nns_function { get; set; } + + public List payload { get; set; } + + public ExecuteNnsFunction(int nnsFunction, List payload) + { + this.nns_function = nnsFunction; + this.payload = payload; + } + + public ExecuteNnsFunction() + { + } + } +} + +Type File: 'Follow' + +using System.Collections.Generic; +using Test.Models; + +namespace Test.Models +{ + public class Follow + { + public int topic { get; set; } + + public List followees { get; set; } + + public Follow(int topic, List followees) + { + this.topic = topic; + this.followees = followees; + } + + public Follow() + { + } + } +} + +Type File: 'Followees' + +using System.Collections.Generic; +using Test.Models; + +namespace Test.Models +{ + public class Followees + { + public List followees { get; set; } + + public Followees(List followees) + { + this.followees = followees; + } + + public Followees() + { + } + } +} + +Type File: 'Governance' + +using System.Collections.Generic; +using Test.Models; +using EdjCase.ICP.Candid.Models; + +namespace Test.Models +{ + public class Governance + { + public Dictionary default_followees { get; set; } + + public ulong wait_for_quiet_threshold_seconds { get; set; } + + public OptionalValue metrics { get; set; } + + public List node_providers { get; set; } + + public OptionalValue economics { get; set; } + + public OptionalValue latest_reward_event { get; set; } + + public List to_claim_transfers { get; set; } + + public ulong short_voting_period_seconds { get; set; } + + public Dictionary proposals { get; set; } + + public Dictionary in_flight_commands { get; set; } + + public Dictionary neurons { get; set; } + + public ulong genesis_timestamp_seconds { get; set; } + + public Governance(Dictionary defaultFollowees, ulong waitForQuietThresholdSeconds, OptionalValue metrics, List nodeProviders, OptionalValue economics, OptionalValue latestRewardEvent, List toClaimTransfers, ulong shortVotingPeriodSeconds, Dictionary proposals, Dictionary inFlightCommands, Dictionary neurons, ulong genesisTimestampSeconds) + { + this.default_followees = defaultFollowees; + this.wait_for_quiet_threshold_seconds = waitForQuietThresholdSeconds; + this.metrics = metrics; + this.node_providers = nodeProviders; + this.economics = economics; + this.latest_reward_event = latestRewardEvent; + this.to_claim_transfers = toClaimTransfers; + this.short_voting_period_seconds = shortVotingPeriodSeconds; + this.proposals = proposals; + this.in_flight_commands = inFlightCommands; + this.neurons = neurons; + this.genesis_timestamp_seconds = genesisTimestampSeconds; + } + + public Governance() + { + } + } +} + +Type File: 'GovernanceCachedMetrics' + +using System.Collections.Generic; + +namespace Test.Models +{ + public class GovernanceCachedMetrics + { + public Dictionary not_dissolving_neurons_e8s_buckets { get; set; } + + public ulong garbage_collectable_neurons_count { get; set; } + + public ulong neurons_with_invalid_stake_count { get; set; } + + public Dictionary not_dissolving_neurons_count_buckets { get; set; } + + public ulong total_supply_icp { get; set; } + + public ulong neurons_with_less_than_6_months_dissolve_delay_count { get; set; } + + public ulong dissolved_neurons_count { get; set; } + + public ulong total_staked_e8s { get; set; } + + public ulong not_dissolving_neurons_count { get; set; } + + public ulong dissolved_neurons_e8s { get; set; } + + public ulong neurons_with_less_than_6_months_dissolve_delay_e8s { get; set; } + + public Dictionary dissolving_neurons_count_buckets { get; set; } + + public ulong dissolving_neurons_count { get; set; } + + public Dictionary dissolving_neurons_e8s_buckets { get; set; } + + public ulong community_fund_total_staked_e8s { get; set; } + + public ulong timestamp_seconds { get; set; } + + public GovernanceCachedMetrics(Dictionary notDissolvingNeuronsE8sBuckets, ulong garbageCollectableNeuronsCount, ulong neuronsWithInvalidStakeCount, Dictionary notDissolvingNeuronsCountBuckets, ulong totalSupplyIcp, ulong neuronsWithLessThan6MonthsDissolveDelayCount, ulong dissolvedNeuronsCount, ulong totalStakedE8s, ulong notDissolvingNeuronsCount, ulong dissolvedNeuronsE8s, ulong neuronsWithLessThan6MonthsDissolveDelayE8s, Dictionary dissolvingNeuronsCountBuckets, ulong dissolvingNeuronsCount, Dictionary dissolvingNeuronsE8sBuckets, ulong communityFundTotalStakedE8s, ulong timestampSeconds) + { + this.not_dissolving_neurons_e8s_buckets = notDissolvingNeuronsE8sBuckets; + this.garbage_collectable_neurons_count = garbageCollectableNeuronsCount; + this.neurons_with_invalid_stake_count = neuronsWithInvalidStakeCount; + this.not_dissolving_neurons_count_buckets = notDissolvingNeuronsCountBuckets; + this.total_supply_icp = totalSupplyIcp; + this.neurons_with_less_than_6_months_dissolve_delay_count = neuronsWithLessThan6MonthsDissolveDelayCount; + this.dissolved_neurons_count = dissolvedNeuronsCount; + this.total_staked_e8s = totalStakedE8s; + this.not_dissolving_neurons_count = notDissolvingNeuronsCount; + this.dissolved_neurons_e8s = dissolvedNeuronsE8s; + this.neurons_with_less_than_6_months_dissolve_delay_e8s = neuronsWithLessThan6MonthsDissolveDelayE8s; + this.dissolving_neurons_count_buckets = dissolvingNeuronsCountBuckets; + this.dissolving_neurons_count = dissolvingNeuronsCount; + this.dissolving_neurons_e8s_buckets = dissolvingNeuronsE8sBuckets; + this.community_fund_total_staked_e8s = communityFundTotalStakedE8s; + this.timestamp_seconds = timestampSeconds; + } + + public GovernanceCachedMetrics() + { + } + } +} + +Type File: 'GovernanceError' + +namespace Test.Models +{ + public class GovernanceError + { + public string error_message { get; set; } + + public int error_type { get; set; } + + public GovernanceError(string errorMessage, int errorType) + { + this.error_message = errorMessage; + this.error_type = errorType; + } + + public GovernanceError() + { + } + } +} + +Type File: 'IncreaseDissolveDelay' + +namespace Test.Models +{ + public class IncreaseDissolveDelay + { + public uint additional_dissolve_delay_seconds { get; set; } + + public IncreaseDissolveDelay(uint additionalDissolveDelaySeconds) + { + this.additional_dissolve_delay_seconds = additionalDissolveDelaySeconds; + } + + public IncreaseDissolveDelay() + { + } + } +} + +Type File: 'KnownNeuron' + +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class KnownNeuron + { + public OptionalValue id { get; set; } + + public OptionalValue known_neuron_data { get; set; } + + public KnownNeuron(OptionalValue id, OptionalValue knownNeuronData) + { + this.id = id; + this.known_neuron_data = knownNeuronData; + } + + public KnownNeuron() + { + } + } +} + +Type File: 'KnownNeuronData' + +using EdjCase.ICP.Candid.Models; + +namespace Test.Models +{ + public class KnownNeuronData + { + public string name { get; set; } + + public OptionalValue description { get; set; } + + public KnownNeuronData(string name, OptionalValue description) + { + this.name = name; + this.description = description; + } + + public KnownNeuronData() + { + } + } +} + +Type File: 'ListKnownNeuronsResponse' + +using System.Collections.Generic; +using Test.Models; + +namespace Test.Models +{ + public class ListKnownNeuronsResponse + { + public List known_neurons { get; set; } + + public ListKnownNeuronsResponse(List knownNeurons) + { + this.known_neurons = knownNeurons; + } + + public ListKnownNeuronsResponse() + { + } + } +} + +Type File: 'ListNeurons' + +using System.Collections.Generic; + +namespace Test.Models +{ + public class ListNeurons + { + public List neuron_ids { get; set; } + + public bool include_neurons_readable_by_caller { get; set; } + + public ListNeurons(List neuronIds, bool includeNeuronsReadableByCaller) + { + this.neuron_ids = neuronIds; + this.include_neurons_readable_by_caller = includeNeuronsReadableByCaller; + } + + public ListNeurons() + { + } + } +} + +Type File: 'ListNeuronsResponse' + +using System.Collections.Generic; +using Test.Models; + +namespace Test.Models +{ + public class ListNeuronsResponse + { + public Dictionary neuron_infos { get; set; } + + public List full_neurons { get; set; } + + public ListNeuronsResponse(Dictionary neuronInfos, List fullNeurons) + { + this.neuron_infos = neuronInfos; + this.full_neurons = fullNeurons; + } + + public ListNeuronsResponse() + { + } + } +} + +Type File: 'ListNodeProvidersResponse' + +using System.Collections.Generic; +using Test.Models; + +namespace Test.Models +{ + public class ListNodeProvidersResponse + { + public List node_providers { get; set; } + + public ListNodeProvidersResponse(List nodeProviders) + { + this.node_providers = nodeProviders; + } + + public ListNodeProvidersResponse() + { + } + } +} + +Type File: 'ListProposalInfo' + +using System.Collections.Generic; +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class ListProposalInfo + { + public List include_reward_status { get; set; } + + public OptionalValue before_proposal { get; set; } + + public uint limit { get; set; } + + public List exclude_topic { get; set; } + + public List include_status { get; set; } + + public ListProposalInfo(List includeRewardStatus, OptionalValue beforeProposal, uint limit, List excludeTopic, List includeStatus) + { + this.include_reward_status = includeRewardStatus; + this.before_proposal = beforeProposal; + this.limit = limit; + this.exclude_topic = excludeTopic; + this.include_status = includeStatus; + } + + public ListProposalInfo() + { + } + } +} + +Type File: 'ListProposalInfoResponse' + +using System.Collections.Generic; +using Test.Models; + +namespace Test.Models +{ + public class ListProposalInfoResponse + { + public List proposal_info { get; set; } + + public ListProposalInfoResponse(List proposalInfo) + { + this.proposal_info = proposalInfo; + } + + public ListProposalInfoResponse() + { + } + } +} + +Type File: 'MakeProposalResponse' + +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class MakeProposalResponse + { + public OptionalValue proposal_id { get; set; } + + public MakeProposalResponse(OptionalValue proposalId) + { + this.proposal_id = proposalId; + } + + public MakeProposalResponse() + { + } + } +} + +Type File: 'ManageNeuron' + +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class ManageNeuron + { + public OptionalValue id { get; set; } + + public OptionalValue command { get; set; } + + public OptionalValue neuron_id_or_subaccount { get; set; } + + public ManageNeuron(OptionalValue id, OptionalValue command, OptionalValue neuronIdOrSubaccount) + { + this.id = id; + this.command = command; + this.neuron_id_or_subaccount = neuronIdOrSubaccount; + } + + public ManageNeuron() + { + } + } +} + +Type File: 'ManageNeuronResponse' + +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class ManageNeuronResponse + { + public OptionalValue command { get; set; } + + public ManageNeuronResponse(OptionalValue command) + { + this.command = command; + } + + public ManageNeuronResponse() + { + } + } +} + +Type File: 'Merge' + +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class Merge + { + public OptionalValue source_neuron_id { get; set; } + + public Merge(OptionalValue sourceNeuronId) + { + this.source_neuron_id = sourceNeuronId; + } + + public Merge() + { + } + } +} + +Type File: 'MergeMaturity' + +namespace Test.Models +{ + public class MergeMaturity + { + public uint percentage_to_merge { get; set; } + + public MergeMaturity(uint percentageToMerge) + { + this.percentage_to_merge = percentageToMerge; + } + + public MergeMaturity() + { + } + } +} + +Type File: 'MergeMaturityResponse' + +namespace Test.Models +{ + public class MergeMaturityResponse + { + public ulong merged_maturity_e8s { get; set; } + + public ulong new_stake_e8s { get; set; } + + public MergeMaturityResponse(ulong mergedMaturityE8s, ulong newStakeE8s) + { + this.merged_maturity_e8s = mergedMaturityE8s; + this.new_stake_e8s = newStakeE8s; + } + + public MergeMaturityResponse() + { + } + } +} + +Type File: 'Motion' + +namespace Test.Models +{ + public class Motion + { + public string motion_text { get; set; } + + public Motion(string motionText) + { + this.motion_text = motionText; + } + + public Motion() + { + } + } +} + +Type File: 'NetworkEconomics' + +namespace Test.Models +{ + public class NetworkEconomics + { + public ulong neuron_minimum_stake_e8s { get; set; } + + public uint max_proposals_to_keep_per_topic { get; set; } + + public ulong neuron_management_fee_per_proposal_e8s { get; set; } + + public ulong reject_cost_e8s { get; set; } + + public ulong transaction_fee_e8s { get; set; } + + public ulong neuron_spawn_dissolve_delay_seconds { get; set; } + + public ulong minimum_icp_xdr_rate { get; set; } + + public ulong maximum_node_provider_rewards_e8s { get; set; } + + public NetworkEconomics(ulong neuronMinimumStakeE8s, uint maxProposalsToKeepPerTopic, ulong neuronManagementFeePerProposalE8s, ulong rejectCostE8s, ulong transactionFeeE8s, ulong neuronSpawnDissolveDelaySeconds, ulong minimumIcpXdrRate, ulong maximumNodeProviderRewardsE8s) + { + this.neuron_minimum_stake_e8s = neuronMinimumStakeE8s; + this.max_proposals_to_keep_per_topic = maxProposalsToKeepPerTopic; + this.neuron_management_fee_per_proposal_e8s = neuronManagementFeePerProposalE8s; + this.reject_cost_e8s = rejectCostE8s; + this.transaction_fee_e8s = transactionFeeE8s; + this.neuron_spawn_dissolve_delay_seconds = neuronSpawnDissolveDelaySeconds; + this.minimum_icp_xdr_rate = minimumIcpXdrRate; + this.maximum_node_provider_rewards_e8s = maximumNodeProviderRewardsE8s; + } + + public NetworkEconomics() + { + } + } +} + +Type File: 'Neuron' + +using EdjCase.ICP.Candid.Models; +using Test.Models; +using System.Collections.Generic; + +namespace Test.Models +{ + public class Neuron + { + public OptionalValue id { get; set; } + + public OptionalValue controller { get; set; } + + public List recent_ballots { get; set; } + + public bool kyc_verified { get; set; } + + public bool not_for_profit { get; set; } + + public ulong maturity_e8s_equivalent { get; set; } + + public ulong cached_neuron_stake_e8s { get; set; } + + public ulong created_timestamp_seconds { get; set; } + + public ulong aging_since_timestamp_seconds { get; set; } + + public List hot_keys { get; set; } + + public List account { get; set; } + + public OptionalValue joined_community_fund_timestamp_seconds { get; set; } + + public OptionalValue dissolve_state { get; set; } + + public Dictionary followees { get; set; } + + public ulong neuron_fees_e8s { get; set; } + + public OptionalValue transfer { get; set; } + + public OptionalValue known_neuron_data { get; set; } + + public Neuron(OptionalValue id, OptionalValue controller, List recentBallots, bool kycVerified, bool notForProfit, ulong maturityE8sEquivalent, ulong cachedNeuronStakeE8s, ulong createdTimestampSeconds, ulong agingSinceTimestampSeconds, List hotKeys, List account, OptionalValue joinedCommunityFundTimestampSeconds, OptionalValue dissolveState, Dictionary followees, ulong neuronFeesE8s, OptionalValue transfer, OptionalValue knownNeuronData) + { + this.id = id; + this.controller = controller; + this.recent_ballots = recentBallots; + this.kyc_verified = kycVerified; + this.not_for_profit = notForProfit; + this.maturity_e8s_equivalent = maturityE8sEquivalent; + this.cached_neuron_stake_e8s = cachedNeuronStakeE8s; + this.created_timestamp_seconds = createdTimestampSeconds; + this.aging_since_timestamp_seconds = agingSinceTimestampSeconds; + this.hot_keys = hotKeys; + this.account = account; + this.joined_community_fund_timestamp_seconds = joinedCommunityFundTimestampSeconds; + this.dissolve_state = dissolveState; + this.followees = followees; + this.neuron_fees_e8s = neuronFeesE8s; + this.transfer = transfer; + this.known_neuron_data = knownNeuronData; + } + + public Neuron() + { + } + } +} + +Type File: 'NeuronId' + +namespace Test.Models +{ + public class NeuronId + { + public ulong id { get; set; } + + public NeuronId(ulong id) + { + this.id = id; + } + + public NeuronId() + { + } + } +} + +Type File: 'NeuronIdOrSubaccount' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; +using System.Collections.Generic; + +namespace Test.Models +{ + [Variant()] + public class NeuronIdOrSubaccount + { + [VariantTagProperty()] + public NeuronIdOrSubaccountTag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public List? Subaccount { get => this.Tag == NeuronIdOrSubaccountTag.Subaccount ? (List)this.Value! : default; set => (this.Tag, this.Value) = (NeuronIdOrSubaccountTag.Subaccount, value); } + + public NeuronId? NeuronId { get => this.Tag == NeuronIdOrSubaccountTag.NeuronId ? (NeuronId)this.Value! : default; set => (this.Tag, this.Value) = (NeuronIdOrSubaccountTag.NeuronId, value); } + + public NeuronIdOrSubaccount(NeuronIdOrSubaccountTag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected NeuronIdOrSubaccount() + { + } + } + + public enum NeuronIdOrSubaccountTag + { + Subaccount, + NeuronId + } +} + +Type File: 'NeuronInFlightCommand' + +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class NeuronInFlightCommand + { + public OptionalValue command { get; set; } + + public ulong timestamp { get; set; } + + public NeuronInFlightCommand(OptionalValue command, ulong timestamp) + { + this.command = command; + this.timestamp = timestamp; + } + + public NeuronInFlightCommand() + { + } + } +} + +Type File: 'NeuronInfo' + +using System.Collections.Generic; +using Test.Models; +using EdjCase.ICP.Candid.Models; + +namespace Test.Models +{ + public class NeuronInfo + { + public ulong dissolve_delay_seconds { get; set; } + + public List recent_ballots { get; set; } + + public ulong created_timestamp_seconds { get; set; } + + public int state { get; set; } + + public ulong stake_e8s { get; set; } + + public OptionalValue joined_community_fund_timestamp_seconds { get; set; } + + public ulong retrieved_at_timestamp_seconds { get; set; } + + public OptionalValue known_neuron_data { get; set; } + + public ulong voting_power { get; set; } + + public ulong age_seconds { get; set; } + + public NeuronInfo(ulong dissolveDelaySeconds, List recentBallots, ulong createdTimestampSeconds, int state, ulong stakeE8s, OptionalValue joinedCommunityFundTimestampSeconds, ulong retrievedAtTimestampSeconds, OptionalValue knownNeuronData, ulong votingPower, ulong ageSeconds) + { + this.dissolve_delay_seconds = dissolveDelaySeconds; + this.recent_ballots = recentBallots; + this.created_timestamp_seconds = createdTimestampSeconds; + this.state = state; + this.stake_e8s = stakeE8s; + this.joined_community_fund_timestamp_seconds = joinedCommunityFundTimestampSeconds; + this.retrieved_at_timestamp_seconds = retrievedAtTimestampSeconds; + this.known_neuron_data = knownNeuronData; + this.voting_power = votingPower; + this.age_seconds = ageSeconds; + } + + public NeuronInfo() + { + } + } +} + +Type File: 'NeuronStakeTransfer' + +using System.Collections.Generic; +using EdjCase.ICP.Candid.Models; + +namespace Test.Models +{ + public class NeuronStakeTransfer + { + public List to_subaccount { get; set; } + + public ulong neuron_stake_e8s { get; set; } + + public OptionalValue from { get; set; } + + public ulong memo { get; set; } + + public List from_subaccount { get; set; } + + public ulong transfer_timestamp { get; set; } + + public ulong block_height { get; set; } + + public NeuronStakeTransfer(List toSubaccount, ulong neuronStakeE8s, OptionalValue from, ulong memo, List fromSubaccount, ulong transferTimestamp, ulong blockHeight) + { + this.to_subaccount = toSubaccount; + this.neuron_stake_e8s = neuronStakeE8s; + this.from = from; + this.memo = memo; + this.from_subaccount = fromSubaccount; + this.transfer_timestamp = transferTimestamp; + this.block_height = blockHeight; + } + + public NeuronStakeTransfer() + { + } + } +} + +Type File: 'NodeProvider' + +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class NodeProvider + { + public OptionalValue id { get; set; } + + public OptionalValue reward_account { get; set; } + + public NodeProvider(OptionalValue id, OptionalValue rewardAccount) + { + this.id = id; + this.reward_account = rewardAccount; + } + + public NodeProvider() + { + } + } +} + +Type File: 'Operation' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; + +namespace Test.Models +{ + [Variant()] + public class Operation + { + [VariantTagProperty()] + public OperationTag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public RemoveHotKey? RemoveHotKey { get => this.Tag == OperationTag.RemoveHotKey ? (RemoveHotKey)this.Value! : default; set => (this.Tag, this.Value) = (OperationTag.RemoveHotKey, value); } + + public AddHotKey? AddHotKey { get => this.Tag == OperationTag.AddHotKey ? (AddHotKey)this.Value! : default; set => (this.Tag, this.Value) = (OperationTag.AddHotKey, value); } + + public Operation.StopDissolvingInfo? StopDissolving { get => this.Tag == OperationTag.StopDissolving ? (Operation.StopDissolvingInfo)this.Value! : default; set => (this.Tag, this.Value) = (OperationTag.StopDissolving, value); } + + public Operation.StartDissolvingInfo? StartDissolving { get => this.Tag == OperationTag.StartDissolving ? (Operation.StartDissolvingInfo)this.Value! : default; set => (this.Tag, this.Value) = (OperationTag.StartDissolving, value); } + + public IncreaseDissolveDelay? IncreaseDissolveDelay { get => this.Tag == OperationTag.IncreaseDissolveDelay ? (IncreaseDissolveDelay)this.Value! : default; set => (this.Tag, this.Value) = (OperationTag.IncreaseDissolveDelay, value); } + + public Operation.JoinCommunityFundInfo? JoinCommunityFund { get => this.Tag == OperationTag.JoinCommunityFund ? (Operation.JoinCommunityFundInfo)this.Value! : default; set => (this.Tag, this.Value) = (OperationTag.JoinCommunityFund, value); } + + public SetDissolveTimestamp? SetDissolveTimestamp { get => this.Tag == OperationTag.SetDissolveTimestamp ? (SetDissolveTimestamp)this.Value! : default; set => (this.Tag, this.Value) = (OperationTag.SetDissolveTimestamp, value); } + + public Operation(OperationTag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected Operation() + { + } + + public class StopDissolvingInfo + { + public StopDissolvingInfo() + { + } + } + + public class StartDissolvingInfo + { + public StartDissolvingInfo() + { + } + } + + public class JoinCommunityFundInfo + { + public JoinCommunityFundInfo() + { + } + } + } + + public enum OperationTag + { + RemoveHotKey, + AddHotKey, + StopDissolving, + StartDissolving, + IncreaseDissolveDelay, + JoinCommunityFund, + SetDissolveTimestamp + } +} + +Type File: 'Proposal' + +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class Proposal + { + public string url { get; set; } + + public OptionalValue title { get; set; } + + public OptionalValue action { get; set; } + + public string summary { get; set; } + + public Proposal(string url, OptionalValue title, OptionalValue action, string summary) + { + this.url = url; + this.title = title; + this.action = action; + this.summary = summary; + } + + public Proposal() + { + } + } +} + +Type File: 'ProposalData' + +using EdjCase.ICP.Candid.Models; +using Test.Models; +using System.Collections.Generic; + +namespace Test.Models +{ + public class ProposalData + { + public OptionalValue id { get; set; } + + public OptionalValue failure_reason { get; set; } + + public Dictionary ballots { get; set; } + + public ulong proposal_timestamp_seconds { get; set; } + + public ulong reward_event_round { get; set; } + + public ulong failed_timestamp_seconds { get; set; } + + public ulong reject_cost_e8s { get; set; } + + public OptionalValue latest_tally { get; set; } + + public ulong decided_timestamp_seconds { get; set; } + + public OptionalValue proposal { get; set; } + + public OptionalValue proposer { get; set; } + + public OptionalValue wait_for_quiet_state { get; set; } + + public ulong executed_timestamp_seconds { get; set; } + + public ProposalData(OptionalValue id, OptionalValue failureReason, Dictionary ballots, ulong proposalTimestampSeconds, ulong rewardEventRound, ulong failedTimestampSeconds, ulong rejectCostE8s, OptionalValue latestTally, ulong decidedTimestampSeconds, OptionalValue proposal, OptionalValue proposer, OptionalValue waitForQuietState, ulong executedTimestampSeconds) + { + this.id = id; + this.failure_reason = failureReason; + this.ballots = ballots; + this.proposal_timestamp_seconds = proposalTimestampSeconds; + this.reward_event_round = rewardEventRound; + this.failed_timestamp_seconds = failedTimestampSeconds; + this.reject_cost_e8s = rejectCostE8s; + this.latest_tally = latestTally; + this.decided_timestamp_seconds = decidedTimestampSeconds; + this.proposal = proposal; + this.proposer = proposer; + this.wait_for_quiet_state = waitForQuietState; + this.executed_timestamp_seconds = executedTimestampSeconds; + } + + public ProposalData() + { + } + } +} + +Type File: 'ProposalInfo' + +using EdjCase.ICP.Candid.Models; +using Test.Models; +using System.Collections.Generic; + +namespace Test.Models +{ + public class ProposalInfo + { + public OptionalValue id { get; set; } + + public int status { get; set; } + + public int topic { get; set; } + + public OptionalValue failure_reason { get; set; } + + public Dictionary ballots { get; set; } + + public ulong proposal_timestamp_seconds { get; set; } + + public ulong reward_event_round { get; set; } + + public OptionalValue deadline_timestamp_seconds { get; set; } + + public ulong failed_timestamp_seconds { get; set; } + + public ulong reject_cost_e8s { get; set; } + + public OptionalValue latest_tally { get; set; } + + public int reward_status { get; set; } + + public ulong decided_timestamp_seconds { get; set; } + + public OptionalValue proposal { get; set; } + + public OptionalValue proposer { get; set; } + + public ulong executed_timestamp_seconds { get; set; } + + public ProposalInfo(OptionalValue id, int status, int topic, OptionalValue failureReason, Dictionary ballots, ulong proposalTimestampSeconds, ulong rewardEventRound, OptionalValue deadlineTimestampSeconds, ulong failedTimestampSeconds, ulong rejectCostE8s, OptionalValue latestTally, int rewardStatus, ulong decidedTimestampSeconds, OptionalValue proposal, OptionalValue proposer, ulong executedTimestampSeconds) + { + this.id = id; + this.status = status; + this.topic = topic; + this.failure_reason = failureReason; + this.ballots = ballots; + this.proposal_timestamp_seconds = proposalTimestampSeconds; + this.reward_event_round = rewardEventRound; + this.deadline_timestamp_seconds = deadlineTimestampSeconds; + this.failed_timestamp_seconds = failedTimestampSeconds; + this.reject_cost_e8s = rejectCostE8s; + this.latest_tally = latestTally; + this.reward_status = rewardStatus; + this.decided_timestamp_seconds = decidedTimestampSeconds; + this.proposal = proposal; + this.proposer = proposer; + this.executed_timestamp_seconds = executedTimestampSeconds; + } + + public ProposalInfo() + { + } + } +} + +Type File: 'RegisterVote' + +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class RegisterVote + { + public int vote { get; set; } + + public OptionalValue proposal { get; set; } + + public RegisterVote(int vote, OptionalValue proposal) + { + this.vote = vote; + this.proposal = proposal; + } + + public RegisterVote() + { + } + } +} + +Type File: 'RemoveHotKey' + +using EdjCase.ICP.Candid.Models; + +namespace Test.Models +{ + public class RemoveHotKey + { + public OptionalValue hot_key_to_remove { get; set; } + + public RemoveHotKey(OptionalValue hotKeyToRemove) + { + this.hot_key_to_remove = hotKeyToRemove; + } + + public RemoveHotKey() + { + } + } +} + +Type File: 'Result' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; + +namespace Test.Models +{ + [Variant()] + public class Result + { + [VariantTagProperty()] + public ResultTag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public GovernanceError? Err { get => this.Tag == ResultTag.Err ? (GovernanceError)this.Value! : default; set => (this.Tag, this.Value) = (ResultTag.Err, value); } + + public Result(ResultTag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected Result() + { + } + } + + public enum ResultTag + { + Ok, + Err + } +} + +Type File: 'Result_1' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; + +namespace Test.Models +{ + [Variant()] + public class Result_1 + { + [VariantTagProperty()] + public Result_1Tag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public GovernanceError? Error { get => this.Tag == Result_1Tag.Error ? (GovernanceError)this.Value! : default; set => (this.Tag, this.Value) = (Result_1Tag.Error, value); } + + public NeuronId? NeuronId { get => this.Tag == Result_1Tag.NeuronId ? (NeuronId)this.Value! : default; set => (this.Tag, this.Value) = (Result_1Tag.NeuronId, value); } + + public Result_1(Result_1Tag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected Result_1() + { + } + } + + public enum Result_1Tag + { + Error, + NeuronId + } +} + +Type File: 'Result_2' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; + +namespace Test.Models +{ + [Variant()] + public class Result_2 + { + [VariantTagProperty()] + public Result_2Tag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public Neuron? Ok { get => this.Tag == Result_2Tag.Ok ? (Neuron)this.Value! : default; set => (this.Tag, this.Value) = (Result_2Tag.Ok, value); } + + public GovernanceError? Err { get => this.Tag == Result_2Tag.Err ? (GovernanceError)this.Value! : default; set => (this.Tag, this.Value) = (Result_2Tag.Err, value); } + + public Result_2(Result_2Tag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected Result_2() + { + } + } + + public enum Result_2Tag + { + Ok, + Err + } +} + +Type File: 'Result_3' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; + +namespace Test.Models +{ + [Variant()] + public class Result_3 + { + [VariantTagProperty()] + public Result_3Tag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public RewardNodeProviders? Ok { get => this.Tag == Result_3Tag.Ok ? (RewardNodeProviders)this.Value! : default; set => (this.Tag, this.Value) = (Result_3Tag.Ok, value); } + + public GovernanceError? Err { get => this.Tag == Result_3Tag.Err ? (GovernanceError)this.Value! : default; set => (this.Tag, this.Value) = (Result_3Tag.Err, value); } + + public Result_3(Result_3Tag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected Result_3() + { + } + } + + public enum Result_3Tag + { + Ok, + Err + } +} + +Type File: 'Result_4' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; + +namespace Test.Models +{ + [Variant()] + public class Result_4 + { + [VariantTagProperty()] + public Result_4Tag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public NeuronInfo? Ok { get => this.Tag == Result_4Tag.Ok ? (NeuronInfo)this.Value! : default; set => (this.Tag, this.Value) = (Result_4Tag.Ok, value); } + + public GovernanceError? Err { get => this.Tag == Result_4Tag.Err ? (GovernanceError)this.Value! : default; set => (this.Tag, this.Value) = (Result_4Tag.Err, value); } + + public Result_4(Result_4Tag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected Result_4() + { + } + } + + public enum Result_4Tag + { + Ok, + Err + } +} + +Type File: 'Result_5' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; + +namespace Test.Models +{ + [Variant()] + public class Result_5 + { + [VariantTagProperty()] + public Result_5Tag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public NodeProvider? Ok { get => this.Tag == Result_5Tag.Ok ? (NodeProvider)this.Value! : default; set => (this.Tag, this.Value) = (Result_5Tag.Ok, value); } + + public GovernanceError? Err { get => this.Tag == Result_5Tag.Err ? (GovernanceError)this.Value! : default; set => (this.Tag, this.Value) = (Result_5Tag.Err, value); } + + public Result_5(Result_5Tag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected Result_5() + { + } + } + + public enum Result_5Tag + { + Ok, + Err + } +} + +Type File: 'RewardEvent' + +using System.Collections.Generic; +using Test.Models; + +namespace Test.Models +{ + public class RewardEvent + { + public ulong day_after_genesis { get; set; } + + public ulong actual_timestamp_seconds { get; set; } + + public ulong distributed_e8s_equivalent { get; set; } + + public List settled_proposals { get; set; } + + public RewardEvent(ulong dayAfterGenesis, ulong actualTimestampSeconds, ulong distributedE8sEquivalent, List settledProposals) + { + this.day_after_genesis = dayAfterGenesis; + this.actual_timestamp_seconds = actualTimestampSeconds; + this.distributed_e8s_equivalent = distributedE8sEquivalent; + this.settled_proposals = settledProposals; + } + + public RewardEvent() + { + } + } +} + +Type File: 'RewardMode' + +using EdjCase.ICP.Candid.Mapping; +using Test.Models; + +namespace Test.Models +{ + [Variant()] + public class RewardMode + { + [VariantTagProperty()] + public RewardModeTag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public RewardToNeuron? RewardToNeuron { get => this.Tag == RewardModeTag.RewardToNeuron ? (RewardToNeuron)this.Value! : default; set => (this.Tag, this.Value) = (RewardModeTag.RewardToNeuron, value); } + + public RewardToAccount? RewardToAccount { get => this.Tag == RewardModeTag.RewardToAccount ? (RewardToAccount)this.Value! : default; set => (this.Tag, this.Value) = (RewardModeTag.RewardToAccount, value); } + + public RewardMode(RewardModeTag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected RewardMode() + { + } + } + + public enum RewardModeTag + { + RewardToNeuron, + RewardToAccount + } +} + +Type File: 'RewardNodeProvider' + +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class RewardNodeProvider + { + public OptionalValue node_provider { get; set; } + + public OptionalValue reward_mode { get; set; } + + public ulong amount_e8s { get; set; } + + public RewardNodeProvider(OptionalValue nodeProvider, OptionalValue rewardMode, ulong amountE8s) + { + this.node_provider = nodeProvider; + this.reward_mode = rewardMode; + this.amount_e8s = amountE8s; + } + + public RewardNodeProvider() + { + } + } +} + +Type File: 'RewardNodeProviders' + +using EdjCase.ICP.Candid.Models; +using System.Collections.Generic; +using Test.Models; + +namespace Test.Models +{ + public class RewardNodeProviders + { + public OptionalValue use_registry_derived_rewards { get; set; } + + public List rewards { get; set; } + + public RewardNodeProviders(OptionalValue useRegistryDerivedRewards, List rewards) + { + this.use_registry_derived_rewards = useRegistryDerivedRewards; + this.rewards = rewards; + } + + public RewardNodeProviders() + { + } + } +} + +Type File: 'RewardToAccount' + +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class RewardToAccount + { + public OptionalValue to_account { get; set; } + + public RewardToAccount(OptionalValue toAccount) + { + this.to_account = toAccount; + } + + public RewardToAccount() + { + } + } +} + +Type File: 'RewardToNeuron' + +namespace Test.Models +{ + public class RewardToNeuron + { + public ulong dissolve_delay_seconds { get; set; } + + public RewardToNeuron(ulong dissolveDelaySeconds) + { + this.dissolve_delay_seconds = dissolveDelaySeconds; + } + + public RewardToNeuron() + { + } + } +} + +Type File: 'SetDefaultFollowees' + +using System.Collections.Generic; +using Test.Models; + +namespace Test.Models +{ + public class SetDefaultFollowees + { + public Dictionary default_followees { get; set; } + + public SetDefaultFollowees(Dictionary defaultFollowees) + { + this.default_followees = defaultFollowees; + } + + public SetDefaultFollowees() + { + } + } +} + +Type File: 'SetDissolveTimestamp' + +namespace Test.Models +{ + public class SetDissolveTimestamp + { + public ulong dissolve_timestamp_seconds { get; set; } + + public SetDissolveTimestamp(ulong dissolveTimestampSeconds) + { + this.dissolve_timestamp_seconds = dissolveTimestampSeconds; + } + + public SetDissolveTimestamp() + { + } + } +} + +Type File: 'Spawn' + +using EdjCase.ICP.Candid.Models; + +namespace Test.Models +{ + public class Spawn + { + public OptionalValue percentage_to_spawn { get; set; } + + public OptionalValue new_controller { get; set; } + + public OptionalValue nonce { get; set; } + + public Spawn(OptionalValue percentageToSpawn, OptionalValue newController, OptionalValue nonce) + { + this.percentage_to_spawn = percentageToSpawn; + this.new_controller = newController; + this.nonce = nonce; + } + + public Spawn() + { + } + } +} + +Type File: 'SpawnResponse' + +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class SpawnResponse + { + public OptionalValue created_neuron_id { get; set; } + + public SpawnResponse(OptionalValue createdNeuronId) + { + this.created_neuron_id = createdNeuronId; + } + + public SpawnResponse() + { + } + } +} + +Type File: 'Split' + +namespace Test.Models +{ + public class Split + { + public ulong amount_e8s { get; set; } + + public Split(ulong amountE8s) + { + this.amount_e8s = amountE8s; + } + + public Split() + { + } + } +} + +Type File: 'Tally' + +namespace Test.Models +{ + public class Tally + { + public ulong no { get; set; } + + public ulong yes { get; set; } + + public ulong total { get; set; } + + public ulong timestamp_seconds { get; set; } + + public Tally(ulong no, ulong yes, ulong total, ulong timestampSeconds) + { + this.no = no; + this.yes = yes; + this.total = total; + this.timestamp_seconds = timestampSeconds; + } + + public Tally() + { + } + } +} + +Type File: 'UpdateNodeProvider' + +using EdjCase.ICP.Candid.Models; +using Test.Models; + +namespace Test.Models +{ + public class UpdateNodeProvider + { + public OptionalValue reward_account { get; set; } + + public UpdateNodeProvider(OptionalValue rewardAccount) + { + this.reward_account = rewardAccount; + } + + public UpdateNodeProvider() + { + } + } +} + +Type File: 'WaitForQuietState' + +namespace Test.Models +{ + public class WaitForQuietState + { + public ulong current_deadline_timestamp_seconds { get; set; } + + public WaitForQuietState(ulong currentDeadlineTimestampSeconds) + { + this.current_deadline_timestamp_seconds = currentDeadlineTimestampSeconds; + } + + public WaitForQuietState() + { + } + } +} diff --git a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_False_KeepCandidCase_False.snap b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False.snap similarity index 95% rename from test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_False_KeepCandidCase_False.snap rename to test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False.snap index b3bb5ae1..154ea6cf 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_False_KeepCandidCase_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_False.snap @@ -210,7 +210,7 @@ using System; namespace Test { - [Variant(typeof(ActionTag))] + [Variant()] public class Action { [VariantTagProperty()] @@ -350,25 +350,15 @@ namespace Test public enum ActionTag { - [VariantOptionType(typeof(KnownNeuron))] RegisterKnownNeuron, - [VariantOptionType(typeof(ManageNeuron))] ManageNeuron, - [VariantOptionType(typeof(ExecuteNnsFunction))] ExecuteNnsFunction, - [VariantOptionType(typeof(RewardNodeProvider))] RewardNodeProvider, - [VariantOptionType(typeof(SetDefaultFollowees))] SetDefaultFollowees, - [VariantOptionType(typeof(RewardNodeProviders))] RewardNodeProviders, - [VariantOptionType(typeof(NetworkEconomics))] ManageNetworkEconomics, - [VariantOptionType(typeof(ApproveGenesisKyc))] ApproveGenesisKyc, - [VariantOptionType(typeof(AddOrRemoveNodeProvider))] AddOrRemoveNodeProvider, - [VariantOptionType(typeof(Motion))] Motion } } @@ -528,7 +518,7 @@ using System; namespace Test { - [Variant(typeof(ByTag))] + [Variant()] public class By { [VariantTagProperty()] @@ -598,11 +588,8 @@ namespace Test public enum ByTag { - [VariantOptionType(typeof(By.NeuronIdOrSubaccountInfo))] NeuronIdOrSubaccount, - [VariantOptionType(typeof(ClaimOrRefreshNeuronFromAccount))] MemoAndController, - [VariantOptionType(typeof(ulong))] Memo } } @@ -615,7 +602,7 @@ using System; namespace Test { - [Variant(typeof(ChangeTag))] + [Variant()] public class Change { [VariantTagProperty()] @@ -667,9 +654,7 @@ namespace Test public enum ChangeTag { - [VariantOptionType(typeof(NodeProvider))] ToRemove, - [VariantOptionType(typeof(NodeProvider))] ToAdd } } @@ -781,7 +766,7 @@ using System; namespace Test { - [Variant(typeof(CommandTag))] + [Variant()] public class Command { [VariantTagProperty()] @@ -932,27 +917,16 @@ namespace Test public enum CommandTag { - [VariantOptionType(typeof(Spawn))] Spawn, - [VariantOptionType(typeof(Split))] Split, - [VariantOptionType(typeof(Follow))] Follow, - [VariantOptionType(typeof(ClaimOrRefresh))] ClaimOrRefresh, - [VariantOptionType(typeof(Configure))] Configure, - [VariantOptionType(typeof(RegisterVote))] RegisterVote, - [VariantOptionType(typeof(Merge))] Merge, - [VariantOptionType(typeof(DisburseToNeuron))] DisburseToNeuron, - [VariantOptionType(typeof(Proposal))] MakeProposal, - [VariantOptionType(typeof(MergeMaturity))] MergeMaturity, - [VariantOptionType(typeof(Disburse))] Disburse } } @@ -965,7 +939,7 @@ using System; namespace Test { - [Variant(typeof(Command1Tag))] + [Variant()] public class Command1 { [VariantTagProperty()] @@ -1155,29 +1129,17 @@ namespace Test public enum Command1Tag { - [VariantOptionType(typeof(GovernanceError))] Error, - [VariantOptionType(typeof(SpawnResponse))] Spawn, - [VariantOptionType(typeof(SpawnResponse))] Split, - [VariantOptionType(typeof(Command1.FollowInfo))] Follow, - [VariantOptionType(typeof(ClaimOrRefreshResponse))] ClaimOrRefresh, - [VariantOptionType(typeof(Command1.ConfigureInfo))] Configure, - [VariantOptionType(typeof(Command1.RegisterVoteInfo))] RegisterVote, - [VariantOptionType(typeof(Command1.MergeInfo))] Merge, - [VariantOptionType(typeof(SpawnResponse))] DisburseToNeuron, - [VariantOptionType(typeof(MakeProposalResponse))] MakeProposal, - [VariantOptionType(typeof(MergeMaturityResponse))] MergeMaturity, - [VariantOptionType(typeof(DisburseResponse))] Disburse } } @@ -1190,7 +1152,7 @@ using System; namespace Test { - [Variant(typeof(Command2Tag))] + [Variant()] public class Command2 { [VariantTagProperty()] @@ -1308,21 +1270,13 @@ namespace Test public enum Command2Tag { - [VariantOptionType(typeof(Spawn))] Spawn, - [VariantOptionType(typeof(Split))] Split, - [VariantOptionType(typeof(Configure))] Configure, - [VariantOptionType(typeof(Merge))] Merge, - [VariantOptionType(typeof(DisburseToNeuron))] DisburseToNeuron, - [VariantOptionType(typeof(ClaimOrRefresh))] ClaimOrRefreshNeuron, - [VariantOptionType(typeof(MergeMaturity))] MergeMaturity, - [VariantOptionType(typeof(Disburse))] Disburse } } @@ -1448,7 +1402,7 @@ using System; namespace Test { - [Variant(typeof(DissolveStateTag))] + [Variant()] public class DissolveState { [VariantTagProperty()] @@ -1500,9 +1454,7 @@ namespace Test public enum DissolveStateTag { - [VariantOptionType(typeof(ulong))] DissolveDelaySeconds, - [VariantOptionType(typeof(ulong))] WhenDissolvedTimestampSeconds } } @@ -2353,7 +2305,7 @@ using System; namespace Test { - [Variant(typeof(NeuronIdOrSubaccountTag))] + [Variant()] public class NeuronIdOrSubaccount { [VariantTagProperty()] @@ -2405,9 +2357,7 @@ namespace Test public enum NeuronIdOrSubaccountTag { - [VariantOptionType(typeof(List))] Subaccount, - [VariantOptionType(typeof(NeuronId))] NeuronId } } @@ -2585,7 +2535,7 @@ using System; namespace Test { - [Variant(typeof(OperationTag))] + [Variant()] public class Operation { [VariantTagProperty()] @@ -2713,19 +2663,12 @@ namespace Test public enum OperationTag { - [VariantOptionType(typeof(RemoveHotKey))] RemoveHotKey, - [VariantOptionType(typeof(AddHotKey))] AddHotKey, - [VariantOptionType(typeof(Operation.StopDissolvingInfo))] StopDissolving, - [VariantOptionType(typeof(Operation.StartDissolvingInfo))] StartDissolving, - [VariantOptionType(typeof(IncreaseDissolveDelay))] IncreaseDissolveDelay, - [VariantOptionType(typeof(Operation.JoinCommunityFundInfo))] JoinCommunityFund, - [VariantOptionType(typeof(SetDissolveTimestamp))] SetDissolveTimestamp } } @@ -2983,7 +2926,7 @@ using System; namespace Test { - [Variant(typeof(ResultTag))] + [Variant()] public class Result { [VariantTagProperty()] @@ -3030,7 +2973,6 @@ namespace Test public enum ResultTag { Ok, - [VariantOptionType(typeof(GovernanceError))] Err } } @@ -3043,7 +2985,7 @@ using System; namespace Test { - [Variant(typeof(Result1Tag))] + [Variant()] public class Result1 { [VariantTagProperty()] @@ -3095,9 +3037,7 @@ namespace Test public enum Result1Tag { - [VariantOptionType(typeof(GovernanceError))] Error, - [VariantOptionType(typeof(NeuronId))] NeuronId } } @@ -3110,7 +3050,7 @@ using System; namespace Test { - [Variant(typeof(Result2Tag))] + [Variant()] public class Result2 { [VariantTagProperty()] @@ -3162,9 +3102,7 @@ namespace Test public enum Result2Tag { - [VariantOptionType(typeof(Neuron))] Ok, - [VariantOptionType(typeof(GovernanceError))] Err } } @@ -3177,7 +3115,7 @@ using System; namespace Test { - [Variant(typeof(Result3Tag))] + [Variant()] public class Result3 { [VariantTagProperty()] @@ -3229,9 +3167,7 @@ namespace Test public enum Result3Tag { - [VariantOptionType(typeof(RewardNodeProviders))] Ok, - [VariantOptionType(typeof(GovernanceError))] Err } } @@ -3244,7 +3180,7 @@ using System; namespace Test { - [Variant(typeof(Result4Tag))] + [Variant()] public class Result4 { [VariantTagProperty()] @@ -3296,9 +3232,7 @@ namespace Test public enum Result4Tag { - [VariantOptionType(typeof(NeuronInfo))] Ok, - [VariantOptionType(typeof(GovernanceError))] Err } } @@ -3311,7 +3245,7 @@ using System; namespace Test { - [Variant(typeof(Result5Tag))] + [Variant()] public class Result5 { [VariantTagProperty()] @@ -3363,9 +3297,7 @@ namespace Test public enum Result5Tag { - [VariantOptionType(typeof(NodeProvider))] Ok, - [VariantOptionType(typeof(GovernanceError))] Err } } @@ -3414,7 +3346,7 @@ using System; namespace Test { - [Variant(typeof(RewardModeTag))] + [Variant()] public class RewardMode { [VariantTagProperty()] @@ -3466,9 +3398,7 @@ namespace Test public enum RewardModeTag { - [VariantOptionType(typeof(RewardToNeuron))] RewardToNeuron, - [VariantOptionType(typeof(RewardToAccount))] RewardToAccount } } diff --git a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True.snap b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True.snap new file mode 100644 index 00000000..0b8e999f --- /dev/null +++ b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_False_KeepCandidCase_False_VariantsUseProperties_True.snap @@ -0,0 +1,2935 @@ +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 +{ + public class GovernanceApiClient + { + public IAgent Agent { get; } + + public Principal CanisterId { get; } + + public CandidConverter Converter { get; } + + public GovernanceApiClient(IAgent agent, Principal canisterId, CandidConverter converter = default) + { + this.Agent = agent; + this.CanisterId = canisterId; + this.Converter = converter; + } + + public async Task ClaimGtcNeurons(Principal arg0, List arg1) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0), CandidTypedValue.FromObject(arg1)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "claim_gtc_neurons", arg); + return reply.ToObjects(this.Converter); + } + + public async Task ClaimOrRefreshNeuronFromAccount(ClaimOrRefreshNeuronFromAccount arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "claim_or_refresh_neuron_from_account", arg); + return reply.ToObjects(this.Converter); + } + + public async Task GetBuildMetadata() + { + CandidArg arg = CandidArg.FromCandid(); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_build_metadata", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + + public async Task GetFullNeuron(ulong arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + + public async Task GetFullNeuronByIdOrSubaccount(NeuronIdOrSubaccount arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron_by_id_or_subaccount", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + + public async Task GetMonthlyNodeProviderRewards() + { + CandidArg arg = CandidArg.FromCandid(); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "get_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(); + 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(); + return reply.ToObjects>(this.Converter); + } + + public async Task GetNeuronInfo(ulong arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + + public async Task GetNeuronInfoByIdOrSubaccount(NeuronIdOrSubaccount arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info_by_id_or_subaccount", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + + public async Task GetNodeProviderByCaller(NullValue arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_node_provider_by_caller", arg); + CandidArg reply = response.ThrowOrGetReply(); + 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(); + return reply.ToObjects>(this.Converter); + } + + public async Task> GetProposalInfo(ulong arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_proposal_info", arg); + CandidArg reply = response.ThrowOrGetReply(); + 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(); + return reply.ToObjects(this.Converter); + } + + public async Task ListNeurons(ListNeurons arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_neurons", arg); + CandidArg reply = response.ThrowOrGetReply(); + 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(); + return reply.ToObjects(this.Converter); + } + + public async Task ListProposals(ListProposalInfo arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_proposals", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + + public async Task ManageNeuron(ManageNeuron arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "manage_neuron", arg); + return reply.ToObjects(this.Converter); + } + + public async Task TransferGtcNeuron(NeuronId arg0, NeuronId arg1) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0), CandidTypedValue.FromObject(arg1)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "transfer_gtc_neuron", arg); + return reply.ToObjects(this.Converter); + } + + public async Task UpdateNodeProvider(UpdateNodeProvider arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "update_node_provider", arg); + return reply.ToObjects(this.Converter); + } + } +} + +Type File: 'AccountIdentifier' + +using EdjCase.ICP.Candid.Mapping; +using System.Collections.Generic; + +namespace Test +{ + public class AccountIdentifier + { + [CandidName("hash")] + public List Hash { get; set; } + + public AccountIdentifier(List hash) + { + this.Hash = hash; + } + + public AccountIdentifier() + { + } + } +} + +Type File: 'Action' + +using EdjCase.ICP.Candid.Mapping; +using Test; + +namespace Test +{ + [Variant()] + public class Action + { + [VariantTagProperty()] + public ActionTag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public KnownNeuron RegisterKnownNeuron { get => this.Tag == ActionTag.RegisterKnownNeuron ? (KnownNeuron)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.RegisterKnownNeuron, value); } + + public ManageNeuron ManageNeuron { get => this.Tag == ActionTag.ManageNeuron ? (ManageNeuron)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.ManageNeuron, value); } + + public ExecuteNnsFunction ExecuteNnsFunction { get => this.Tag == ActionTag.ExecuteNnsFunction ? (ExecuteNnsFunction)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.ExecuteNnsFunction, value); } + + public RewardNodeProvider RewardNodeProvider { get => this.Tag == ActionTag.RewardNodeProvider ? (RewardNodeProvider)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.RewardNodeProvider, value); } + + public SetDefaultFollowees SetDefaultFollowees { get => this.Tag == ActionTag.SetDefaultFollowees ? (SetDefaultFollowees)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.SetDefaultFollowees, value); } + + public RewardNodeProviders RewardNodeProviders { get => this.Tag == ActionTag.RewardNodeProviders ? (RewardNodeProviders)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.RewardNodeProviders, value); } + + public NetworkEconomics ManageNetworkEconomics { get => this.Tag == ActionTag.ManageNetworkEconomics ? (NetworkEconomics)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.ManageNetworkEconomics, value); } + + public ApproveGenesisKyc ApproveGenesisKyc { get => this.Tag == ActionTag.ApproveGenesisKyc ? (ApproveGenesisKyc)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.ApproveGenesisKyc, value); } + + public AddOrRemoveNodeProvider AddOrRemoveNodeProvider { get => this.Tag == ActionTag.AddOrRemoveNodeProvider ? (AddOrRemoveNodeProvider)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.AddOrRemoveNodeProvider, value); } + + public Motion Motion { get => this.Tag == ActionTag.Motion ? (Motion)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.Motion, value); } + + public Action(ActionTag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected Action() + { + } + } + + public enum ActionTag + { + RegisterKnownNeuron, + ManageNeuron, + ExecuteNnsFunction, + RewardNodeProvider, + SetDefaultFollowees, + RewardNodeProviders, + ManageNetworkEconomics, + ApproveGenesisKyc, + AddOrRemoveNodeProvider, + Motion + } +} + +Type File: 'AddHotKey' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; + +namespace Test +{ + public class AddHotKey + { + [CandidName("new_hot_key")] + public OptionalValue NewHotKey { get; set; } + + public AddHotKey(OptionalValue newHotKey) + { + this.NewHotKey = newHotKey; + } + + public AddHotKey() + { + } + } +} + +Type File: 'AddOrRemoveNodeProvider' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class AddOrRemoveNodeProvider + { + [CandidName("change")] + public OptionalValue Change { get; set; } + + public AddOrRemoveNodeProvider(OptionalValue change) + { + this.Change = change; + } + + public AddOrRemoveNodeProvider() + { + } + } +} + +Type File: 'Amount' + +using EdjCase.ICP.Candid.Mapping; + +namespace Test +{ + public class Amount + { + [CandidName("e8s")] + public ulong E8s { get; set; } + + public Amount(ulong e8s) + { + this.E8s = e8s; + } + + public Amount() + { + } + } +} + +Type File: 'ApproveGenesisKyc' + +using EdjCase.ICP.Candid.Mapping; +using System.Collections.Generic; +using EdjCase.ICP.Candid.Models; + +namespace Test +{ + public class ApproveGenesisKyc + { + [CandidName("principals")] + public List Principals { get; set; } + + public ApproveGenesisKyc(List principals) + { + this.Principals = principals; + } + + public ApproveGenesisKyc() + { + } + } +} + +Type File: 'Ballot' + +using EdjCase.ICP.Candid.Mapping; + +namespace Test +{ + public class Ballot + { + [CandidName("vote")] + public int Vote { get; set; } + + [CandidName("voting_power")] + public ulong VotingPower { get; set; } + + public Ballot(int vote, ulong votingPower) + { + this.Vote = vote; + this.VotingPower = votingPower; + } + + public Ballot() + { + } + } +} + +Type File: 'BallotInfo' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class BallotInfo + { + [CandidName("vote")] + public int Vote { get; set; } + + [CandidName("proposal_id")] + public OptionalValue ProposalId { get; set; } + + public BallotInfo(int vote, OptionalValue proposalId) + { + this.Vote = vote; + this.ProposalId = proposalId; + } + + public BallotInfo() + { + } + } +} + +Type File: 'By' + +using EdjCase.ICP.Candid.Mapping; +using Test; + +namespace Test +{ + [Variant()] + public class By + { + [VariantTagProperty()] + public ByTag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public By.NeuronIdOrSubaccountInfo NeuronIdOrSubaccount { get => this.Tag == ByTag.NeuronIdOrSubaccount ? (By.NeuronIdOrSubaccountInfo)this.Value! : default; set => (this.Tag, this.Value) = (ByTag.NeuronIdOrSubaccount, value); } + + public ClaimOrRefreshNeuronFromAccount MemoAndController { get => this.Tag == ByTag.MemoAndController ? (ClaimOrRefreshNeuronFromAccount)this.Value! : default; set => (this.Tag, this.Value) = (ByTag.MemoAndController, value); } + + public ulong Memo { get => this.Tag == ByTag.Memo ? (ulong)this.Value! : default; set => (this.Tag, this.Value) = (ByTag.Memo, value); } + + public By(ByTag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected By() + { + } + + public class NeuronIdOrSubaccountInfo + { + public NeuronIdOrSubaccountInfo() + { + } + } + } + + public enum ByTag + { + NeuronIdOrSubaccount, + MemoAndController, + Memo + } +} + +Type File: 'Change' + +using EdjCase.ICP.Candid.Mapping; +using Test; + +namespace Test +{ + [Variant()] + public class Change + { + [VariantTagProperty()] + public ChangeTag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public NodeProvider ToRemove { get => this.Tag == ChangeTag.ToRemove ? (NodeProvider)this.Value! : default; set => (this.Tag, this.Value) = (ChangeTag.ToRemove, value); } + + public NodeProvider ToAdd { get => this.Tag == ChangeTag.ToAdd ? (NodeProvider)this.Value! : default; set => (this.Tag, this.Value) = (ChangeTag.ToAdd, value); } + + public Change(ChangeTag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected Change() + { + } + } + + public enum ChangeTag + { + ToRemove, + ToAdd + } +} + +Type File: 'ClaimOrRefresh' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class ClaimOrRefresh + { + [CandidName("by")] + public OptionalValue By { get; set; } + + public ClaimOrRefresh(OptionalValue by) + { + this.By = by; + } + + public ClaimOrRefresh() + { + } + } +} + +Type File: 'ClaimOrRefreshNeuronFromAccount' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; + +namespace Test +{ + public class ClaimOrRefreshNeuronFromAccount + { + [CandidName("controller")] + public OptionalValue Controller { get; set; } + + [CandidName("memo")] + public ulong Memo { get; set; } + + public ClaimOrRefreshNeuronFromAccount(OptionalValue controller, ulong memo) + { + this.Controller = controller; + this.Memo = memo; + } + + public ClaimOrRefreshNeuronFromAccount() + { + } + } +} + +Type File: 'ClaimOrRefreshNeuronFromAccountResponse' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class ClaimOrRefreshNeuronFromAccountResponse + { + [CandidName("result")] + public OptionalValue Result { get; set; } + + public ClaimOrRefreshNeuronFromAccountResponse(OptionalValue result) + { + this.Result = result; + } + + public ClaimOrRefreshNeuronFromAccountResponse() + { + } + } +} + +Type File: 'ClaimOrRefreshResponse' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class ClaimOrRefreshResponse + { + [CandidName("refreshed_neuron_id")] + public OptionalValue RefreshedNeuronId { get; set; } + + public ClaimOrRefreshResponse(OptionalValue refreshedNeuronId) + { + this.RefreshedNeuronId = refreshedNeuronId; + } + + public ClaimOrRefreshResponse() + { + } + } +} + +Type File: 'Command' + +using EdjCase.ICP.Candid.Mapping; +using Test; + +namespace Test +{ + [Variant()] + public class Command + { + [VariantTagProperty()] + public CommandTag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public Spawn Spawn { get => this.Tag == CommandTag.Spawn ? (Spawn)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.Spawn, value); } + + public Split Split { get => this.Tag == CommandTag.Split ? (Split)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.Split, value); } + + public Follow Follow { get => this.Tag == CommandTag.Follow ? (Follow)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.Follow, value); } + + public ClaimOrRefresh ClaimOrRefresh { get => this.Tag == CommandTag.ClaimOrRefresh ? (ClaimOrRefresh)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.ClaimOrRefresh, value); } + + public Configure Configure { get => this.Tag == CommandTag.Configure ? (Configure)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.Configure, value); } + + public RegisterVote RegisterVote { get => this.Tag == CommandTag.RegisterVote ? (RegisterVote)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.RegisterVote, value); } + + public Merge Merge { get => this.Tag == CommandTag.Merge ? (Merge)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.Merge, value); } + + public DisburseToNeuron DisburseToNeuron { get => this.Tag == CommandTag.DisburseToNeuron ? (DisburseToNeuron)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.DisburseToNeuron, value); } + + public Proposal MakeProposal { get => this.Tag == CommandTag.MakeProposal ? (Proposal)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.MakeProposal, value); } + + public MergeMaturity MergeMaturity { get => this.Tag == CommandTag.MergeMaturity ? (MergeMaturity)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.MergeMaturity, value); } + + public Disburse Disburse { get => this.Tag == CommandTag.Disburse ? (Disburse)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.Disburse, value); } + + public Command(CommandTag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected Command() + { + } + } + + public enum CommandTag + { + Spawn, + Split, + Follow, + ClaimOrRefresh, + Configure, + RegisterVote, + Merge, + DisburseToNeuron, + MakeProposal, + MergeMaturity, + Disburse + } +} + +Type File: 'Command1' + +using EdjCase.ICP.Candid.Mapping; +using Test; + +namespace Test +{ + [Variant()] + public class Command1 + { + [VariantTagProperty()] + public Command1Tag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public GovernanceError Error { get => this.Tag == Command1Tag.Error ? (GovernanceError)this.Value! : default; set => (this.Tag, this.Value) = (Command1Tag.Error, value); } + + public SpawnResponse Spawn { get => this.Tag == Command1Tag.Spawn ? (SpawnResponse)this.Value! : default; set => (this.Tag, this.Value) = (Command1Tag.Spawn, value); } + + public SpawnResponse Split { get => this.Tag == Command1Tag.Split ? (SpawnResponse)this.Value! : default; set => (this.Tag, this.Value) = (Command1Tag.Split, value); } + + public Command1.FollowInfo Follow { get => this.Tag == Command1Tag.Follow ? (Command1.FollowInfo)this.Value! : default; set => (this.Tag, this.Value) = (Command1Tag.Follow, value); } + + public ClaimOrRefreshResponse ClaimOrRefresh { get => this.Tag == Command1Tag.ClaimOrRefresh ? (ClaimOrRefreshResponse)this.Value! : default; set => (this.Tag, this.Value) = (Command1Tag.ClaimOrRefresh, value); } + + public Command1.ConfigureInfo Configure { get => this.Tag == Command1Tag.Configure ? (Command1.ConfigureInfo)this.Value! : default; set => (this.Tag, this.Value) = (Command1Tag.Configure, value); } + + public Command1.RegisterVoteInfo RegisterVote { get => this.Tag == Command1Tag.RegisterVote ? (Command1.RegisterVoteInfo)this.Value! : default; set => (this.Tag, this.Value) = (Command1Tag.RegisterVote, value); } + + public Command1.MergeInfo Merge { get => this.Tag == Command1Tag.Merge ? (Command1.MergeInfo)this.Value! : default; set => (this.Tag, this.Value) = (Command1Tag.Merge, value); } + + public SpawnResponse DisburseToNeuron { get => this.Tag == Command1Tag.DisburseToNeuron ? (SpawnResponse)this.Value! : default; set => (this.Tag, this.Value) = (Command1Tag.DisburseToNeuron, value); } + + public MakeProposalResponse MakeProposal { get => this.Tag == Command1Tag.MakeProposal ? (MakeProposalResponse)this.Value! : default; set => (this.Tag, this.Value) = (Command1Tag.MakeProposal, value); } + + public MergeMaturityResponse MergeMaturity { get => this.Tag == Command1Tag.MergeMaturity ? (MergeMaturityResponse)this.Value! : default; set => (this.Tag, this.Value) = (Command1Tag.MergeMaturity, value); } + + public DisburseResponse Disburse { get => this.Tag == Command1Tag.Disburse ? (DisburseResponse)this.Value! : default; set => (this.Tag, this.Value) = (Command1Tag.Disburse, value); } + + public Command1(Command1Tag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected Command1() + { + } + + public class FollowInfo + { + public FollowInfo() + { + } + } + + public class ConfigureInfo + { + public ConfigureInfo() + { + } + } + + public class RegisterVoteInfo + { + public RegisterVoteInfo() + { + } + } + + public class MergeInfo + { + public MergeInfo() + { + } + } + } + + public enum Command1Tag + { + Error, + Spawn, + Split, + Follow, + ClaimOrRefresh, + Configure, + RegisterVote, + Merge, + DisburseToNeuron, + MakeProposal, + MergeMaturity, + Disburse + } +} + +Type File: 'Command2' + +using EdjCase.ICP.Candid.Mapping; +using Test; + +namespace Test +{ + [Variant()] + public class Command2 + { + [VariantTagProperty()] + public Command2Tag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public Spawn Spawn { get => this.Tag == Command2Tag.Spawn ? (Spawn)this.Value! : default; set => (this.Tag, this.Value) = (Command2Tag.Spawn, value); } + + public Split Split { get => this.Tag == Command2Tag.Split ? (Split)this.Value! : default; set => (this.Tag, this.Value) = (Command2Tag.Split, value); } + + public Configure Configure { get => this.Tag == Command2Tag.Configure ? (Configure)this.Value! : default; set => (this.Tag, this.Value) = (Command2Tag.Configure, value); } + + public Merge Merge { get => this.Tag == Command2Tag.Merge ? (Merge)this.Value! : default; set => (this.Tag, this.Value) = (Command2Tag.Merge, value); } + + public DisburseToNeuron DisburseToNeuron { get => this.Tag == Command2Tag.DisburseToNeuron ? (DisburseToNeuron)this.Value! : default; set => (this.Tag, this.Value) = (Command2Tag.DisburseToNeuron, value); } + + public ClaimOrRefresh ClaimOrRefreshNeuron { get => this.Tag == Command2Tag.ClaimOrRefreshNeuron ? (ClaimOrRefresh)this.Value! : default; set => (this.Tag, this.Value) = (Command2Tag.ClaimOrRefreshNeuron, value); } + + public MergeMaturity MergeMaturity { get => this.Tag == Command2Tag.MergeMaturity ? (MergeMaturity)this.Value! : default; set => (this.Tag, this.Value) = (Command2Tag.MergeMaturity, value); } + + public Disburse Disburse { get => this.Tag == Command2Tag.Disburse ? (Disburse)this.Value! : default; set => (this.Tag, this.Value) = (Command2Tag.Disburse, value); } + + public Command2(Command2Tag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected Command2() + { + } + } + + public enum Command2Tag + { + Spawn, + Split, + Configure, + Merge, + DisburseToNeuron, + ClaimOrRefreshNeuron, + MergeMaturity, + Disburse + } +} + +Type File: 'Configure' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class Configure + { + [CandidName("operation")] + public OptionalValue Operation { get; set; } + + public Configure(OptionalValue operation) + { + this.Operation = operation; + } + + public Configure() + { + } + } +} + +Type File: 'Disburse' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class Disburse + { + [CandidName("to_account")] + public OptionalValue ToAccount { get; set; } + + [CandidName("amount")] + public OptionalValue Amount { get; set; } + + public Disburse(OptionalValue toAccount, OptionalValue amount) + { + this.ToAccount = toAccount; + this.Amount = amount; + } + + public Disburse() + { + } + } +} + +Type File: 'DisburseResponse' + +using EdjCase.ICP.Candid.Mapping; + +namespace Test +{ + public class DisburseResponse + { + [CandidName("transfer_block_height")] + public ulong TransferBlockHeight { get; set; } + + public DisburseResponse(ulong transferBlockHeight) + { + this.TransferBlockHeight = transferBlockHeight; + } + + public DisburseResponse() + { + } + } +} + +Type File: 'DisburseToNeuron' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; + +namespace Test +{ + public class DisburseToNeuron + { + [CandidName("dissolve_delay_seconds")] + public ulong DissolveDelaySeconds { get; set; } + + [CandidName("kyc_verified")] + public bool KycVerified { get; set; } + + [CandidName("amount_e8s")] + public ulong AmountE8s { get; set; } + + [CandidName("new_controller")] + public OptionalValue NewController { get; set; } + + [CandidName("nonce")] + public ulong Nonce { get; set; } + + public DisburseToNeuron(ulong dissolveDelaySeconds, bool kycVerified, ulong amountE8s, OptionalValue newController, ulong nonce) + { + this.DissolveDelaySeconds = dissolveDelaySeconds; + this.KycVerified = kycVerified; + this.AmountE8s = amountE8s; + this.NewController = newController; + this.Nonce = nonce; + } + + public DisburseToNeuron() + { + } + } +} + +Type File: 'DissolveState' + +using EdjCase.ICP.Candid.Mapping; +using Test; + +namespace Test +{ + [Variant()] + public class DissolveState + { + [VariantTagProperty()] + public DissolveStateTag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public ulong DissolveDelaySeconds { get => this.Tag == DissolveStateTag.DissolveDelaySeconds ? (ulong)this.Value! : default; set => (this.Tag, this.Value) = (DissolveStateTag.DissolveDelaySeconds, value); } + + public ulong WhenDissolvedTimestampSeconds { get => this.Tag == DissolveStateTag.WhenDissolvedTimestampSeconds ? (ulong)this.Value! : default; set => (this.Tag, this.Value) = (DissolveStateTag.WhenDissolvedTimestampSeconds, value); } + + public DissolveState(DissolveStateTag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected DissolveState() + { + } + } + + public enum DissolveStateTag + { + DissolveDelaySeconds, + WhenDissolvedTimestampSeconds + } +} + +Type File: 'ExecuteNnsFunction' + +using EdjCase.ICP.Candid.Mapping; +using System.Collections.Generic; + +namespace Test +{ + public class ExecuteNnsFunction + { + [CandidName("nns_function")] + public int NnsFunction { get; set; } + + [CandidName("payload")] + public List Payload { get; set; } + + public ExecuteNnsFunction(int nnsFunction, List payload) + { + this.NnsFunction = nnsFunction; + this.Payload = payload; + } + + public ExecuteNnsFunction() + { + } + } +} + +Type File: 'Follow' + +using EdjCase.ICP.Candid.Mapping; +using System.Collections.Generic; +using Test; + +namespace Test +{ + public class Follow + { + [CandidName("topic")] + public int Topic { get; set; } + + [CandidName("followees")] + public List Followees { get; set; } + + public Follow(int topic, List followees) + { + this.Topic = topic; + this.Followees = followees; + } + + public Follow() + { + } + } +} + +Type File: 'Followees' + +using EdjCase.ICP.Candid.Mapping; +using System.Collections.Generic; +using Test; + +namespace Test +{ + public class Followees + { + [CandidName("followees")] + public List Followees_ { get; set; } + + public Followees(List followees) + { + this.Followees_ = followees; + } + + public Followees() + { + } + } +} + +Type File: 'Governance' + +using EdjCase.ICP.Candid.Mapping; +using System.Collections.Generic; +using Test; +using EdjCase.ICP.Candid.Models; + +namespace Test +{ + public class Governance + { + [CandidName("default_followees")] + public Dictionary DefaultFollowees { get; set; } + + [CandidName("wait_for_quiet_threshold_seconds")] + public ulong WaitForQuietThresholdSeconds { get; set; } + + [CandidName("metrics")] + public OptionalValue Metrics { get; set; } + + [CandidName("node_providers")] + public List NodeProviders { get; set; } + + [CandidName("economics")] + public OptionalValue Economics { get; set; } + + [CandidName("latest_reward_event")] + public OptionalValue LatestRewardEvent { get; set; } + + [CandidName("to_claim_transfers")] + public List ToClaimTransfers { get; set; } + + [CandidName("short_voting_period_seconds")] + public ulong ShortVotingPeriodSeconds { get; set; } + + [CandidName("proposals")] + public Dictionary Proposals { get; set; } + + [CandidName("in_flight_commands")] + public Dictionary InFlightCommands { get; set; } + + [CandidName("neurons")] + public Dictionary Neurons { get; set; } + + [CandidName("genesis_timestamp_seconds")] + public ulong GenesisTimestampSeconds { get; set; } + + public Governance(Dictionary defaultFollowees, ulong waitForQuietThresholdSeconds, OptionalValue metrics, List nodeProviders, OptionalValue economics, OptionalValue latestRewardEvent, List toClaimTransfers, ulong shortVotingPeriodSeconds, Dictionary proposals, Dictionary inFlightCommands, Dictionary neurons, ulong genesisTimestampSeconds) + { + this.DefaultFollowees = defaultFollowees; + this.WaitForQuietThresholdSeconds = waitForQuietThresholdSeconds; + this.Metrics = metrics; + this.NodeProviders = nodeProviders; + this.Economics = economics; + this.LatestRewardEvent = latestRewardEvent; + this.ToClaimTransfers = toClaimTransfers; + this.ShortVotingPeriodSeconds = shortVotingPeriodSeconds; + this.Proposals = proposals; + this.InFlightCommands = inFlightCommands; + this.Neurons = neurons; + this.GenesisTimestampSeconds = genesisTimestampSeconds; + } + + public Governance() + { + } + } +} + +Type File: 'GovernanceCachedMetrics' + +using EdjCase.ICP.Candid.Mapping; +using System.Collections.Generic; + +namespace Test +{ + public class GovernanceCachedMetrics + { + [CandidName("not_dissolving_neurons_e8s_buckets")] + public Dictionary NotDissolvingNeuronsE8sBuckets { get; set; } + + [CandidName("garbage_collectable_neurons_count")] + public ulong GarbageCollectableNeuronsCount { get; set; } + + [CandidName("neurons_with_invalid_stake_count")] + public ulong NeuronsWithInvalidStakeCount { get; set; } + + [CandidName("not_dissolving_neurons_count_buckets")] + public Dictionary NotDissolvingNeuronsCountBuckets { get; set; } + + [CandidName("total_supply_icp")] + public ulong TotalSupplyIcp { get; set; } + + [CandidName("neurons_with_less_than_6_months_dissolve_delay_count")] + public ulong NeuronsWithLessThan6MonthsDissolveDelayCount { get; set; } + + [CandidName("dissolved_neurons_count")] + public ulong DissolvedNeuronsCount { get; set; } + + [CandidName("total_staked_e8s")] + public ulong TotalStakedE8s { get; set; } + + [CandidName("not_dissolving_neurons_count")] + public ulong NotDissolvingNeuronsCount { get; set; } + + [CandidName("dissolved_neurons_e8s")] + public ulong DissolvedNeuronsE8s { get; set; } + + [CandidName("neurons_with_less_than_6_months_dissolve_delay_e8s")] + public ulong NeuronsWithLessThan6MonthsDissolveDelayE8s { get; set; } + + [CandidName("dissolving_neurons_count_buckets")] + public Dictionary DissolvingNeuronsCountBuckets { get; set; } + + [CandidName("dissolving_neurons_count")] + public ulong DissolvingNeuronsCount { get; set; } + + [CandidName("dissolving_neurons_e8s_buckets")] + public Dictionary DissolvingNeuronsE8sBuckets { get; set; } + + [CandidName("community_fund_total_staked_e8s")] + public ulong CommunityFundTotalStakedE8s { get; set; } + + [CandidName("timestamp_seconds")] + public ulong TimestampSeconds { get; set; } + + public GovernanceCachedMetrics(Dictionary notDissolvingNeuronsE8sBuckets, ulong garbageCollectableNeuronsCount, ulong neuronsWithInvalidStakeCount, Dictionary notDissolvingNeuronsCountBuckets, ulong totalSupplyIcp, ulong neuronsWithLessThan6MonthsDissolveDelayCount, ulong dissolvedNeuronsCount, ulong totalStakedE8s, ulong notDissolvingNeuronsCount, ulong dissolvedNeuronsE8s, ulong neuronsWithLessThan6MonthsDissolveDelayE8s, Dictionary dissolvingNeuronsCountBuckets, ulong dissolvingNeuronsCount, Dictionary dissolvingNeuronsE8sBuckets, ulong communityFundTotalStakedE8s, ulong timestampSeconds) + { + this.NotDissolvingNeuronsE8sBuckets = notDissolvingNeuronsE8sBuckets; + this.GarbageCollectableNeuronsCount = garbageCollectableNeuronsCount; + this.NeuronsWithInvalidStakeCount = neuronsWithInvalidStakeCount; + this.NotDissolvingNeuronsCountBuckets = notDissolvingNeuronsCountBuckets; + this.TotalSupplyIcp = totalSupplyIcp; + this.NeuronsWithLessThan6MonthsDissolveDelayCount = neuronsWithLessThan6MonthsDissolveDelayCount; + this.DissolvedNeuronsCount = dissolvedNeuronsCount; + this.TotalStakedE8s = totalStakedE8s; + this.NotDissolvingNeuronsCount = notDissolvingNeuronsCount; + this.DissolvedNeuronsE8s = dissolvedNeuronsE8s; + this.NeuronsWithLessThan6MonthsDissolveDelayE8s = neuronsWithLessThan6MonthsDissolveDelayE8s; + this.DissolvingNeuronsCountBuckets = dissolvingNeuronsCountBuckets; + this.DissolvingNeuronsCount = dissolvingNeuronsCount; + this.DissolvingNeuronsE8sBuckets = dissolvingNeuronsE8sBuckets; + this.CommunityFundTotalStakedE8s = communityFundTotalStakedE8s; + this.TimestampSeconds = timestampSeconds; + } + + public GovernanceCachedMetrics() + { + } + } +} + +Type File: 'GovernanceError' + +using EdjCase.ICP.Candid.Mapping; + +namespace Test +{ + public class GovernanceError + { + [CandidName("error_message")] + public string ErrorMessage { get; set; } + + [CandidName("error_type")] + public int ErrorType { get; set; } + + public GovernanceError(string errorMessage, int errorType) + { + this.ErrorMessage = errorMessage; + this.ErrorType = errorType; + } + + public GovernanceError() + { + } + } +} + +Type File: 'IncreaseDissolveDelay' + +using EdjCase.ICP.Candid.Mapping; + +namespace Test +{ + public class IncreaseDissolveDelay + { + [CandidName("additional_dissolve_delay_seconds")] + public uint AdditionalDissolveDelaySeconds { get; set; } + + public IncreaseDissolveDelay(uint additionalDissolveDelaySeconds) + { + this.AdditionalDissolveDelaySeconds = additionalDissolveDelaySeconds; + } + + public IncreaseDissolveDelay() + { + } + } +} + +Type File: 'KnownNeuron' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class KnownNeuron + { + [CandidName("id")] + public OptionalValue Id { get; set; } + + [CandidName("known_neuron_data")] + public OptionalValue KnownNeuronData { get; set; } + + public KnownNeuron(OptionalValue id, OptionalValue knownNeuronData) + { + this.Id = id; + this.KnownNeuronData = knownNeuronData; + } + + public KnownNeuron() + { + } + } +} + +Type File: 'KnownNeuronData' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; + +namespace Test +{ + public class KnownNeuronData + { + [CandidName("name")] + public string Name { get; set; } + + [CandidName("description")] + public OptionalValue Description { get; set; } + + public KnownNeuronData(string name, OptionalValue description) + { + this.Name = name; + this.Description = description; + } + + public KnownNeuronData() + { + } + } +} + +Type File: 'ListKnownNeuronsResponse' + +using EdjCase.ICP.Candid.Mapping; +using System.Collections.Generic; +using Test; + +namespace Test +{ + public class ListKnownNeuronsResponse + { + [CandidName("known_neurons")] + public List KnownNeurons { get; set; } + + public ListKnownNeuronsResponse(List knownNeurons) + { + this.KnownNeurons = knownNeurons; + } + + public ListKnownNeuronsResponse() + { + } + } +} + +Type File: 'ListNeurons' + +using EdjCase.ICP.Candid.Mapping; +using System.Collections.Generic; + +namespace Test +{ + public class ListNeurons + { + [CandidName("neuron_ids")] + public List NeuronIds { get; set; } + + [CandidName("include_neurons_readable_by_caller")] + public bool IncludeNeuronsReadableByCaller { get; set; } + + public ListNeurons(List neuronIds, bool includeNeuronsReadableByCaller) + { + this.NeuronIds = neuronIds; + this.IncludeNeuronsReadableByCaller = includeNeuronsReadableByCaller; + } + + public ListNeurons() + { + } + } +} + +Type File: 'ListNeuronsResponse' + +using EdjCase.ICP.Candid.Mapping; +using System.Collections.Generic; +using Test; + +namespace Test +{ + public class ListNeuronsResponse + { + [CandidName("neuron_infos")] + public Dictionary NeuronInfos { get; set; } + + [CandidName("full_neurons")] + public List FullNeurons { get; set; } + + public ListNeuronsResponse(Dictionary neuronInfos, List fullNeurons) + { + this.NeuronInfos = neuronInfos; + this.FullNeurons = fullNeurons; + } + + public ListNeuronsResponse() + { + } + } +} + +Type File: 'ListNodeProvidersResponse' + +using EdjCase.ICP.Candid.Mapping; +using System.Collections.Generic; +using Test; + +namespace Test +{ + public class ListNodeProvidersResponse + { + [CandidName("node_providers")] + public List NodeProviders { get; set; } + + public ListNodeProvidersResponse(List nodeProviders) + { + this.NodeProviders = nodeProviders; + } + + public ListNodeProvidersResponse() + { + } + } +} + +Type File: 'ListProposalInfo' + +using EdjCase.ICP.Candid.Mapping; +using System.Collections.Generic; +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class ListProposalInfo + { + [CandidName("include_reward_status")] + public List IncludeRewardStatus { get; set; } + + [CandidName("before_proposal")] + public OptionalValue BeforeProposal { get; set; } + + [CandidName("limit")] + public uint Limit { get; set; } + + [CandidName("exclude_topic")] + public List ExcludeTopic { get; set; } + + [CandidName("include_status")] + public List IncludeStatus { get; set; } + + public ListProposalInfo(List includeRewardStatus, OptionalValue beforeProposal, uint limit, List excludeTopic, List includeStatus) + { + this.IncludeRewardStatus = includeRewardStatus; + this.BeforeProposal = beforeProposal; + this.Limit = limit; + this.ExcludeTopic = excludeTopic; + this.IncludeStatus = includeStatus; + } + + public ListProposalInfo() + { + } + } +} + +Type File: 'ListProposalInfoResponse' + +using EdjCase.ICP.Candid.Mapping; +using System.Collections.Generic; +using Test; + +namespace Test +{ + public class ListProposalInfoResponse + { + [CandidName("proposal_info")] + public List ProposalInfo { get; set; } + + public ListProposalInfoResponse(List proposalInfo) + { + this.ProposalInfo = proposalInfo; + } + + public ListProposalInfoResponse() + { + } + } +} + +Type File: 'MakeProposalResponse' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class MakeProposalResponse + { + [CandidName("proposal_id")] + public OptionalValue ProposalId { get; set; } + + public MakeProposalResponse(OptionalValue proposalId) + { + this.ProposalId = proposalId; + } + + public MakeProposalResponse() + { + } + } +} + +Type File: 'ManageNeuron' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class ManageNeuron + { + [CandidName("id")] + public OptionalValue Id { get; set; } + + [CandidName("command")] + public OptionalValue Command { get; set; } + + [CandidName("neuron_id_or_subaccount")] + public OptionalValue NeuronIdOrSubaccount { get; set; } + + public ManageNeuron(OptionalValue id, OptionalValue command, OptionalValue neuronIdOrSubaccount) + { + this.Id = id; + this.Command = command; + this.NeuronIdOrSubaccount = neuronIdOrSubaccount; + } + + public ManageNeuron() + { + } + } +} + +Type File: 'ManageNeuronResponse' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class ManageNeuronResponse + { + [CandidName("command")] + public OptionalValue Command { get; set; } + + public ManageNeuronResponse(OptionalValue command) + { + this.Command = command; + } + + public ManageNeuronResponse() + { + } + } +} + +Type File: 'Merge' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class Merge + { + [CandidName("source_neuron_id")] + public OptionalValue SourceNeuronId { get; set; } + + public Merge(OptionalValue sourceNeuronId) + { + this.SourceNeuronId = sourceNeuronId; + } + + public Merge() + { + } + } +} + +Type File: 'MergeMaturity' + +using EdjCase.ICP.Candid.Mapping; + +namespace Test +{ + public class MergeMaturity + { + [CandidName("percentage_to_merge")] + public uint PercentageToMerge { get; set; } + + public MergeMaturity(uint percentageToMerge) + { + this.PercentageToMerge = percentageToMerge; + } + + public MergeMaturity() + { + } + } +} + +Type File: 'MergeMaturityResponse' + +using EdjCase.ICP.Candid.Mapping; + +namespace Test +{ + public class MergeMaturityResponse + { + [CandidName("merged_maturity_e8s")] + public ulong MergedMaturityE8s { get; set; } + + [CandidName("new_stake_e8s")] + public ulong NewStakeE8s { get; set; } + + public MergeMaturityResponse(ulong mergedMaturityE8s, ulong newStakeE8s) + { + this.MergedMaturityE8s = mergedMaturityE8s; + this.NewStakeE8s = newStakeE8s; + } + + public MergeMaturityResponse() + { + } + } +} + +Type File: 'Motion' + +using EdjCase.ICP.Candid.Mapping; + +namespace Test +{ + public class Motion + { + [CandidName("motion_text")] + public string MotionText { get; set; } + + public Motion(string motionText) + { + this.MotionText = motionText; + } + + public Motion() + { + } + } +} + +Type File: 'NetworkEconomics' + +using EdjCase.ICP.Candid.Mapping; + +namespace Test +{ + public class NetworkEconomics + { + [CandidName("neuron_minimum_stake_e8s")] + public ulong NeuronMinimumStakeE8s { get; set; } + + [CandidName("max_proposals_to_keep_per_topic")] + public uint MaxProposalsToKeepPerTopic { get; set; } + + [CandidName("neuron_management_fee_per_proposal_e8s")] + public ulong NeuronManagementFeePerProposalE8s { get; set; } + + [CandidName("reject_cost_e8s")] + public ulong RejectCostE8s { get; set; } + + [CandidName("transaction_fee_e8s")] + public ulong TransactionFeeE8s { get; set; } + + [CandidName("neuron_spawn_dissolve_delay_seconds")] + public ulong NeuronSpawnDissolveDelaySeconds { get; set; } + + [CandidName("minimum_icp_xdr_rate")] + public ulong MinimumIcpXdrRate { get; set; } + + [CandidName("maximum_node_provider_rewards_e8s")] + public ulong MaximumNodeProviderRewardsE8s { get; set; } + + public NetworkEconomics(ulong neuronMinimumStakeE8s, uint maxProposalsToKeepPerTopic, ulong neuronManagementFeePerProposalE8s, ulong rejectCostE8s, ulong transactionFeeE8s, ulong neuronSpawnDissolveDelaySeconds, ulong minimumIcpXdrRate, ulong maximumNodeProviderRewardsE8s) + { + this.NeuronMinimumStakeE8s = neuronMinimumStakeE8s; + this.MaxProposalsToKeepPerTopic = maxProposalsToKeepPerTopic; + this.NeuronManagementFeePerProposalE8s = neuronManagementFeePerProposalE8s; + this.RejectCostE8s = rejectCostE8s; + this.TransactionFeeE8s = transactionFeeE8s; + this.NeuronSpawnDissolveDelaySeconds = neuronSpawnDissolveDelaySeconds; + this.MinimumIcpXdrRate = minimumIcpXdrRate; + this.MaximumNodeProviderRewardsE8s = maximumNodeProviderRewardsE8s; + } + + public NetworkEconomics() + { + } + } +} + +Type File: 'Neuron' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test; +using System.Collections.Generic; + +namespace Test +{ + public class Neuron + { + [CandidName("id")] + public OptionalValue Id { get; set; } + + [CandidName("controller")] + public OptionalValue Controller { get; set; } + + [CandidName("recent_ballots")] + public List RecentBallots { get; set; } + + [CandidName("kyc_verified")] + public bool KycVerified { get; set; } + + [CandidName("not_for_profit")] + public bool NotForProfit { get; set; } + + [CandidName("maturity_e8s_equivalent")] + public ulong MaturityE8sEquivalent { get; set; } + + [CandidName("cached_neuron_stake_e8s")] + public ulong CachedNeuronStakeE8s { get; set; } + + [CandidName("created_timestamp_seconds")] + public ulong CreatedTimestampSeconds { get; set; } + + [CandidName("aging_since_timestamp_seconds")] + public ulong AgingSinceTimestampSeconds { get; set; } + + [CandidName("hot_keys")] + public List HotKeys { get; set; } + + [CandidName("account")] + public List Account { get; set; } + + [CandidName("joined_community_fund_timestamp_seconds")] + public OptionalValue JoinedCommunityFundTimestampSeconds { get; set; } + + [CandidName("dissolve_state")] + public OptionalValue DissolveState { get; set; } + + [CandidName("followees")] + public Dictionary Followees { get; set; } + + [CandidName("neuron_fees_e8s")] + public ulong NeuronFeesE8s { get; set; } + + [CandidName("transfer")] + public OptionalValue Transfer { get; set; } + + [CandidName("known_neuron_data")] + public OptionalValue KnownNeuronData { get; set; } + + public Neuron(OptionalValue id, OptionalValue controller, List recentBallots, bool kycVerified, bool notForProfit, ulong maturityE8sEquivalent, ulong cachedNeuronStakeE8s, ulong createdTimestampSeconds, ulong agingSinceTimestampSeconds, List hotKeys, List account, OptionalValue joinedCommunityFundTimestampSeconds, OptionalValue dissolveState, Dictionary followees, ulong neuronFeesE8s, OptionalValue transfer, OptionalValue knownNeuronData) + { + this.Id = id; + this.Controller = controller; + this.RecentBallots = recentBallots; + this.KycVerified = kycVerified; + this.NotForProfit = notForProfit; + this.MaturityE8sEquivalent = maturityE8sEquivalent; + this.CachedNeuronStakeE8s = cachedNeuronStakeE8s; + this.CreatedTimestampSeconds = createdTimestampSeconds; + this.AgingSinceTimestampSeconds = agingSinceTimestampSeconds; + this.HotKeys = hotKeys; + this.Account = account; + this.JoinedCommunityFundTimestampSeconds = joinedCommunityFundTimestampSeconds; + this.DissolveState = dissolveState; + this.Followees = followees; + this.NeuronFeesE8s = neuronFeesE8s; + this.Transfer = transfer; + this.KnownNeuronData = knownNeuronData; + } + + public Neuron() + { + } + } +} + +Type File: 'NeuronId' + +using EdjCase.ICP.Candid.Mapping; + +namespace Test +{ + public class NeuronId + { + [CandidName("id")] + public ulong Id { get; set; } + + public NeuronId(ulong id) + { + this.Id = id; + } + + public NeuronId() + { + } + } +} + +Type File: 'NeuronIdOrSubaccount' + +using EdjCase.ICP.Candid.Mapping; +using Test; +using System.Collections.Generic; + +namespace Test +{ + [Variant()] + public class NeuronIdOrSubaccount + { + [VariantTagProperty()] + public NeuronIdOrSubaccountTag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public List Subaccount { get => this.Tag == NeuronIdOrSubaccountTag.Subaccount ? (List)this.Value! : default; set => (this.Tag, this.Value) = (NeuronIdOrSubaccountTag.Subaccount, value); } + + public NeuronId NeuronId { get => this.Tag == NeuronIdOrSubaccountTag.NeuronId ? (NeuronId)this.Value! : default; set => (this.Tag, this.Value) = (NeuronIdOrSubaccountTag.NeuronId, value); } + + public NeuronIdOrSubaccount(NeuronIdOrSubaccountTag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected NeuronIdOrSubaccount() + { + } + } + + public enum NeuronIdOrSubaccountTag + { + Subaccount, + NeuronId + } +} + +Type File: 'NeuronInFlightCommand' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class NeuronInFlightCommand + { + [CandidName("command")] + public OptionalValue Command { get; set; } + + [CandidName("timestamp")] + public ulong Timestamp { get; set; } + + public NeuronInFlightCommand(OptionalValue command, ulong timestamp) + { + this.Command = command; + this.Timestamp = timestamp; + } + + public NeuronInFlightCommand() + { + } + } +} + +Type File: 'NeuronInfo' + +using EdjCase.ICP.Candid.Mapping; +using System.Collections.Generic; +using Test; +using EdjCase.ICP.Candid.Models; + +namespace Test +{ + public class NeuronInfo + { + [CandidName("dissolve_delay_seconds")] + public ulong DissolveDelaySeconds { get; set; } + + [CandidName("recent_ballots")] + public List RecentBallots { get; set; } + + [CandidName("created_timestamp_seconds")] + public ulong CreatedTimestampSeconds { get; set; } + + [CandidName("state")] + public int State { get; set; } + + [CandidName("stake_e8s")] + public ulong StakeE8s { get; set; } + + [CandidName("joined_community_fund_timestamp_seconds")] + public OptionalValue JoinedCommunityFundTimestampSeconds { get; set; } + + [CandidName("retrieved_at_timestamp_seconds")] + public ulong RetrievedAtTimestampSeconds { get; set; } + + [CandidName("known_neuron_data")] + public OptionalValue KnownNeuronData { get; set; } + + [CandidName("voting_power")] + public ulong VotingPower { get; set; } + + [CandidName("age_seconds")] + public ulong AgeSeconds { get; set; } + + public NeuronInfo(ulong dissolveDelaySeconds, List recentBallots, ulong createdTimestampSeconds, int state, ulong stakeE8s, OptionalValue joinedCommunityFundTimestampSeconds, ulong retrievedAtTimestampSeconds, OptionalValue knownNeuronData, ulong votingPower, ulong ageSeconds) + { + this.DissolveDelaySeconds = dissolveDelaySeconds; + this.RecentBallots = recentBallots; + this.CreatedTimestampSeconds = createdTimestampSeconds; + this.State = state; + this.StakeE8s = stakeE8s; + this.JoinedCommunityFundTimestampSeconds = joinedCommunityFundTimestampSeconds; + this.RetrievedAtTimestampSeconds = retrievedAtTimestampSeconds; + this.KnownNeuronData = knownNeuronData; + this.VotingPower = votingPower; + this.AgeSeconds = ageSeconds; + } + + public NeuronInfo() + { + } + } +} + +Type File: 'NeuronStakeTransfer' + +using EdjCase.ICP.Candid.Mapping; +using System.Collections.Generic; +using EdjCase.ICP.Candid.Models; + +namespace Test +{ + public class NeuronStakeTransfer + { + [CandidName("to_subaccount")] + public List ToSubaccount { get; set; } + + [CandidName("neuron_stake_e8s")] + public ulong NeuronStakeE8s { get; set; } + + [CandidName("from")] + public OptionalValue From { get; set; } + + [CandidName("memo")] + public ulong Memo { get; set; } + + [CandidName("from_subaccount")] + public List FromSubaccount { get; set; } + + [CandidName("transfer_timestamp")] + public ulong TransferTimestamp { get; set; } + + [CandidName("block_height")] + public ulong BlockHeight { get; set; } + + public NeuronStakeTransfer(List toSubaccount, ulong neuronStakeE8s, OptionalValue from, ulong memo, List fromSubaccount, ulong transferTimestamp, ulong blockHeight) + { + this.ToSubaccount = toSubaccount; + this.NeuronStakeE8s = neuronStakeE8s; + this.From = from; + this.Memo = memo; + this.FromSubaccount = fromSubaccount; + this.TransferTimestamp = transferTimestamp; + this.BlockHeight = blockHeight; + } + + public NeuronStakeTransfer() + { + } + } +} + +Type File: 'NodeProvider' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class NodeProvider + { + [CandidName("id")] + public OptionalValue Id { get; set; } + + [CandidName("reward_account")] + public OptionalValue RewardAccount { get; set; } + + public NodeProvider(OptionalValue id, OptionalValue rewardAccount) + { + this.Id = id; + this.RewardAccount = rewardAccount; + } + + public NodeProvider() + { + } + } +} + +Type File: 'Operation' + +using EdjCase.ICP.Candid.Mapping; +using Test; + +namespace Test +{ + [Variant()] + public class Operation + { + [VariantTagProperty()] + public OperationTag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public RemoveHotKey RemoveHotKey { get => this.Tag == OperationTag.RemoveHotKey ? (RemoveHotKey)this.Value! : default; set => (this.Tag, this.Value) = (OperationTag.RemoveHotKey, value); } + + public AddHotKey AddHotKey { get => this.Tag == OperationTag.AddHotKey ? (AddHotKey)this.Value! : default; set => (this.Tag, this.Value) = (OperationTag.AddHotKey, value); } + + public Operation.StopDissolvingInfo StopDissolving { get => this.Tag == OperationTag.StopDissolving ? (Operation.StopDissolvingInfo)this.Value! : default; set => (this.Tag, this.Value) = (OperationTag.StopDissolving, value); } + + public Operation.StartDissolvingInfo StartDissolving { get => this.Tag == OperationTag.StartDissolving ? (Operation.StartDissolvingInfo)this.Value! : default; set => (this.Tag, this.Value) = (OperationTag.StartDissolving, value); } + + public IncreaseDissolveDelay IncreaseDissolveDelay { get => this.Tag == OperationTag.IncreaseDissolveDelay ? (IncreaseDissolveDelay)this.Value! : default; set => (this.Tag, this.Value) = (OperationTag.IncreaseDissolveDelay, value); } + + public Operation.JoinCommunityFundInfo JoinCommunityFund { get => this.Tag == OperationTag.JoinCommunityFund ? (Operation.JoinCommunityFundInfo)this.Value! : default; set => (this.Tag, this.Value) = (OperationTag.JoinCommunityFund, value); } + + public SetDissolveTimestamp SetDissolveTimestamp { get => this.Tag == OperationTag.SetDissolveTimestamp ? (SetDissolveTimestamp)this.Value! : default; set => (this.Tag, this.Value) = (OperationTag.SetDissolveTimestamp, value); } + + public Operation(OperationTag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected Operation() + { + } + + public class StopDissolvingInfo + { + public StopDissolvingInfo() + { + } + } + + public class StartDissolvingInfo + { + public StartDissolvingInfo() + { + } + } + + public class JoinCommunityFundInfo + { + public JoinCommunityFundInfo() + { + } + } + } + + public enum OperationTag + { + RemoveHotKey, + AddHotKey, + StopDissolving, + StartDissolving, + IncreaseDissolveDelay, + JoinCommunityFund, + SetDissolveTimestamp + } +} + +Type File: 'Proposal' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class Proposal + { + [CandidName("url")] + public string Url { get; set; } + + [CandidName("title")] + public OptionalValue Title { get; set; } + + [CandidName("action")] + public OptionalValue Action { get; set; } + + [CandidName("summary")] + public string Summary { get; set; } + + public Proposal(string url, OptionalValue title, OptionalValue action, string summary) + { + this.Url = url; + this.Title = title; + this.Action = action; + this.Summary = summary; + } + + public Proposal() + { + } + } +} + +Type File: 'ProposalData' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test; +using System.Collections.Generic; + +namespace Test +{ + public class ProposalData + { + [CandidName("id")] + public OptionalValue Id { get; set; } + + [CandidName("failure_reason")] + public OptionalValue FailureReason { get; set; } + + [CandidName("ballots")] + public Dictionary Ballots { get; set; } + + [CandidName("proposal_timestamp_seconds")] + public ulong ProposalTimestampSeconds { get; set; } + + [CandidName("reward_event_round")] + public ulong RewardEventRound { get; set; } + + [CandidName("failed_timestamp_seconds")] + public ulong FailedTimestampSeconds { get; set; } + + [CandidName("reject_cost_e8s")] + public ulong RejectCostE8s { get; set; } + + [CandidName("latest_tally")] + public OptionalValue LatestTally { get; set; } + + [CandidName("decided_timestamp_seconds")] + public ulong DecidedTimestampSeconds { get; set; } + + [CandidName("proposal")] + public OptionalValue Proposal { get; set; } + + [CandidName("proposer")] + public OptionalValue Proposer { get; set; } + + [CandidName("wait_for_quiet_state")] + public OptionalValue WaitForQuietState { get; set; } + + [CandidName("executed_timestamp_seconds")] + public ulong ExecutedTimestampSeconds { get; set; } + + public ProposalData(OptionalValue id, OptionalValue failureReason, Dictionary ballots, ulong proposalTimestampSeconds, ulong rewardEventRound, ulong failedTimestampSeconds, ulong rejectCostE8s, OptionalValue latestTally, ulong decidedTimestampSeconds, OptionalValue proposal, OptionalValue proposer, OptionalValue waitForQuietState, ulong executedTimestampSeconds) + { + this.Id = id; + this.FailureReason = failureReason; + this.Ballots = ballots; + this.ProposalTimestampSeconds = proposalTimestampSeconds; + this.RewardEventRound = rewardEventRound; + this.FailedTimestampSeconds = failedTimestampSeconds; + this.RejectCostE8s = rejectCostE8s; + this.LatestTally = latestTally; + this.DecidedTimestampSeconds = decidedTimestampSeconds; + this.Proposal = proposal; + this.Proposer = proposer; + this.WaitForQuietState = waitForQuietState; + this.ExecutedTimestampSeconds = executedTimestampSeconds; + } + + public ProposalData() + { + } + } +} + +Type File: 'ProposalInfo' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test; +using System.Collections.Generic; + +namespace Test +{ + public class ProposalInfo + { + [CandidName("id")] + public OptionalValue Id { get; set; } + + [CandidName("status")] + public int Status { get; set; } + + [CandidName("topic")] + public int Topic { get; set; } + + [CandidName("failure_reason")] + public OptionalValue FailureReason { get; set; } + + [CandidName("ballots")] + public Dictionary Ballots { get; set; } + + [CandidName("proposal_timestamp_seconds")] + public ulong ProposalTimestampSeconds { get; set; } + + [CandidName("reward_event_round")] + public ulong RewardEventRound { get; set; } + + [CandidName("deadline_timestamp_seconds")] + public OptionalValue DeadlineTimestampSeconds { get; set; } + + [CandidName("failed_timestamp_seconds")] + public ulong FailedTimestampSeconds { get; set; } + + [CandidName("reject_cost_e8s")] + public ulong RejectCostE8s { get; set; } + + [CandidName("latest_tally")] + public OptionalValue LatestTally { get; set; } + + [CandidName("reward_status")] + public int RewardStatus { get; set; } + + [CandidName("decided_timestamp_seconds")] + public ulong DecidedTimestampSeconds { get; set; } + + [CandidName("proposal")] + public OptionalValue Proposal { get; set; } + + [CandidName("proposer")] + public OptionalValue Proposer { get; set; } + + [CandidName("executed_timestamp_seconds")] + public ulong ExecutedTimestampSeconds { get; set; } + + public ProposalInfo(OptionalValue id, int status, int topic, OptionalValue failureReason, Dictionary ballots, ulong proposalTimestampSeconds, ulong rewardEventRound, OptionalValue deadlineTimestampSeconds, ulong failedTimestampSeconds, ulong rejectCostE8s, OptionalValue latestTally, int rewardStatus, ulong decidedTimestampSeconds, OptionalValue proposal, OptionalValue proposer, ulong executedTimestampSeconds) + { + this.Id = id; + this.Status = status; + this.Topic = topic; + this.FailureReason = failureReason; + this.Ballots = ballots; + this.ProposalTimestampSeconds = proposalTimestampSeconds; + this.RewardEventRound = rewardEventRound; + this.DeadlineTimestampSeconds = deadlineTimestampSeconds; + this.FailedTimestampSeconds = failedTimestampSeconds; + this.RejectCostE8s = rejectCostE8s; + this.LatestTally = latestTally; + this.RewardStatus = rewardStatus; + this.DecidedTimestampSeconds = decidedTimestampSeconds; + this.Proposal = proposal; + this.Proposer = proposer; + this.ExecutedTimestampSeconds = executedTimestampSeconds; + } + + public ProposalInfo() + { + } + } +} + +Type File: 'RegisterVote' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class RegisterVote + { + [CandidName("vote")] + public int Vote { get; set; } + + [CandidName("proposal")] + public OptionalValue Proposal { get; set; } + + public RegisterVote(int vote, OptionalValue proposal) + { + this.Vote = vote; + this.Proposal = proposal; + } + + public RegisterVote() + { + } + } +} + +Type File: 'RemoveHotKey' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; + +namespace Test +{ + public class RemoveHotKey + { + [CandidName("hot_key_to_remove")] + public OptionalValue HotKeyToRemove { get; set; } + + public RemoveHotKey(OptionalValue hotKeyToRemove) + { + this.HotKeyToRemove = hotKeyToRemove; + } + + public RemoveHotKey() + { + } + } +} + +Type File: 'Result' + +using EdjCase.ICP.Candid.Mapping; +using Test; + +namespace Test +{ + [Variant()] + public class Result + { + [VariantTagProperty()] + public ResultTag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public GovernanceError Err { get => this.Tag == ResultTag.Err ? (GovernanceError)this.Value! : default; set => (this.Tag, this.Value) = (ResultTag.Err, value); } + + public Result(ResultTag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected Result() + { + } + } + + public enum ResultTag + { + Ok, + Err + } +} + +Type File: 'Result1' + +using EdjCase.ICP.Candid.Mapping; +using Test; + +namespace Test +{ + [Variant()] + public class Result1 + { + [VariantTagProperty()] + public Result1Tag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public GovernanceError Error { get => this.Tag == Result1Tag.Error ? (GovernanceError)this.Value! : default; set => (this.Tag, this.Value) = (Result1Tag.Error, value); } + + public NeuronId NeuronId { get => this.Tag == Result1Tag.NeuronId ? (NeuronId)this.Value! : default; set => (this.Tag, this.Value) = (Result1Tag.NeuronId, value); } + + public Result1(Result1Tag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected Result1() + { + } + } + + public enum Result1Tag + { + Error, + NeuronId + } +} + +Type File: 'Result2' + +using EdjCase.ICP.Candid.Mapping; +using Test; + +namespace Test +{ + [Variant()] + public class Result2 + { + [VariantTagProperty()] + public Result2Tag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public Neuron Ok { get => this.Tag == Result2Tag.Ok ? (Neuron)this.Value! : default; set => (this.Tag, this.Value) = (Result2Tag.Ok, value); } + + public GovernanceError Err { get => this.Tag == Result2Tag.Err ? (GovernanceError)this.Value! : default; set => (this.Tag, this.Value) = (Result2Tag.Err, value); } + + public Result2(Result2Tag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected Result2() + { + } + } + + public enum Result2Tag + { + Ok, + Err + } +} + +Type File: 'Result3' + +using EdjCase.ICP.Candid.Mapping; +using Test; + +namespace Test +{ + [Variant()] + public class Result3 + { + [VariantTagProperty()] + public Result3Tag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public RewardNodeProviders Ok { get => this.Tag == Result3Tag.Ok ? (RewardNodeProviders)this.Value! : default; set => (this.Tag, this.Value) = (Result3Tag.Ok, value); } + + public GovernanceError Err { get => this.Tag == Result3Tag.Err ? (GovernanceError)this.Value! : default; set => (this.Tag, this.Value) = (Result3Tag.Err, value); } + + public Result3(Result3Tag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected Result3() + { + } + } + + public enum Result3Tag + { + Ok, + Err + } +} + +Type File: 'Result4' + +using EdjCase.ICP.Candid.Mapping; +using Test; + +namespace Test +{ + [Variant()] + public class Result4 + { + [VariantTagProperty()] + public Result4Tag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public NeuronInfo Ok { get => this.Tag == Result4Tag.Ok ? (NeuronInfo)this.Value! : default; set => (this.Tag, this.Value) = (Result4Tag.Ok, value); } + + public GovernanceError Err { get => this.Tag == Result4Tag.Err ? (GovernanceError)this.Value! : default; set => (this.Tag, this.Value) = (Result4Tag.Err, value); } + + public Result4(Result4Tag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected Result4() + { + } + } + + public enum Result4Tag + { + Ok, + Err + } +} + +Type File: 'Result5' + +using EdjCase.ICP.Candid.Mapping; +using Test; + +namespace Test +{ + [Variant()] + public class Result5 + { + [VariantTagProperty()] + public Result5Tag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public NodeProvider Ok { get => this.Tag == Result5Tag.Ok ? (NodeProvider)this.Value! : default; set => (this.Tag, this.Value) = (Result5Tag.Ok, value); } + + public GovernanceError Err { get => this.Tag == Result5Tag.Err ? (GovernanceError)this.Value! : default; set => (this.Tag, this.Value) = (Result5Tag.Err, value); } + + public Result5(Result5Tag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected Result5() + { + } + } + + public enum Result5Tag + { + Ok, + Err + } +} + +Type File: 'RewardEvent' + +using EdjCase.ICP.Candid.Mapping; +using System.Collections.Generic; +using Test; + +namespace Test +{ + public class RewardEvent + { + [CandidName("day_after_genesis")] + public ulong DayAfterGenesis { get; set; } + + [CandidName("actual_timestamp_seconds")] + public ulong ActualTimestampSeconds { get; set; } + + [CandidName("distributed_e8s_equivalent")] + public ulong DistributedE8sEquivalent { get; set; } + + [CandidName("settled_proposals")] + public List SettledProposals { get; set; } + + public RewardEvent(ulong dayAfterGenesis, ulong actualTimestampSeconds, ulong distributedE8sEquivalent, List settledProposals) + { + this.DayAfterGenesis = dayAfterGenesis; + this.ActualTimestampSeconds = actualTimestampSeconds; + this.DistributedE8sEquivalent = distributedE8sEquivalent; + this.SettledProposals = settledProposals; + } + + public RewardEvent() + { + } + } +} + +Type File: 'RewardMode' + +using EdjCase.ICP.Candid.Mapping; +using Test; + +namespace Test +{ + [Variant()] + public class RewardMode + { + [VariantTagProperty()] + public RewardModeTag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public RewardToNeuron RewardToNeuron { get => this.Tag == RewardModeTag.RewardToNeuron ? (RewardToNeuron)this.Value! : default; set => (this.Tag, this.Value) = (RewardModeTag.RewardToNeuron, value); } + + public RewardToAccount RewardToAccount { get => this.Tag == RewardModeTag.RewardToAccount ? (RewardToAccount)this.Value! : default; set => (this.Tag, this.Value) = (RewardModeTag.RewardToAccount, value); } + + public RewardMode(RewardModeTag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected RewardMode() + { + } + } + + public enum RewardModeTag + { + RewardToNeuron, + RewardToAccount + } +} + +Type File: 'RewardNodeProvider' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class RewardNodeProvider + { + [CandidName("node_provider")] + public OptionalValue NodeProvider { get; set; } + + [CandidName("reward_mode")] + public OptionalValue RewardMode { get; set; } + + [CandidName("amount_e8s")] + public ulong AmountE8s { get; set; } + + public RewardNodeProvider(OptionalValue nodeProvider, OptionalValue rewardMode, ulong amountE8s) + { + this.NodeProvider = nodeProvider; + this.RewardMode = rewardMode; + this.AmountE8s = amountE8s; + } + + public RewardNodeProvider() + { + } + } +} + +Type File: 'RewardNodeProviders' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using System.Collections.Generic; +using Test; + +namespace Test +{ + public class RewardNodeProviders + { + [CandidName("use_registry_derived_rewards")] + public OptionalValue UseRegistryDerivedRewards { get; set; } + + [CandidName("rewards")] + public List Rewards { get; set; } + + public RewardNodeProviders(OptionalValue useRegistryDerivedRewards, List rewards) + { + this.UseRegistryDerivedRewards = useRegistryDerivedRewards; + this.Rewards = rewards; + } + + public RewardNodeProviders() + { + } + } +} + +Type File: 'RewardToAccount' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class RewardToAccount + { + [CandidName("to_account")] + public OptionalValue ToAccount { get; set; } + + public RewardToAccount(OptionalValue toAccount) + { + this.ToAccount = toAccount; + } + + public RewardToAccount() + { + } + } +} + +Type File: 'RewardToNeuron' + +using EdjCase.ICP.Candid.Mapping; + +namespace Test +{ + public class RewardToNeuron + { + [CandidName("dissolve_delay_seconds")] + public ulong DissolveDelaySeconds { get; set; } + + public RewardToNeuron(ulong dissolveDelaySeconds) + { + this.DissolveDelaySeconds = dissolveDelaySeconds; + } + + public RewardToNeuron() + { + } + } +} + +Type File: 'SetDefaultFollowees' + +using EdjCase.ICP.Candid.Mapping; +using System.Collections.Generic; +using Test; + +namespace Test +{ + public class SetDefaultFollowees + { + [CandidName("default_followees")] + public Dictionary DefaultFollowees { get; set; } + + public SetDefaultFollowees(Dictionary defaultFollowees) + { + this.DefaultFollowees = defaultFollowees; + } + + public SetDefaultFollowees() + { + } + } +} + +Type File: 'SetDissolveTimestamp' + +using EdjCase.ICP.Candid.Mapping; + +namespace Test +{ + public class SetDissolveTimestamp + { + [CandidName("dissolve_timestamp_seconds")] + public ulong DissolveTimestampSeconds { get; set; } + + public SetDissolveTimestamp(ulong dissolveTimestampSeconds) + { + this.DissolveTimestampSeconds = dissolveTimestampSeconds; + } + + public SetDissolveTimestamp() + { + } + } +} + +Type File: 'Spawn' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; + +namespace Test +{ + public class Spawn + { + [CandidName("percentage_to_spawn")] + public OptionalValue PercentageToSpawn { get; set; } + + [CandidName("new_controller")] + public OptionalValue NewController { get; set; } + + [CandidName("nonce")] + public OptionalValue Nonce { get; set; } + + public Spawn(OptionalValue percentageToSpawn, OptionalValue newController, OptionalValue nonce) + { + this.PercentageToSpawn = percentageToSpawn; + this.NewController = newController; + this.Nonce = nonce; + } + + public Spawn() + { + } + } +} + +Type File: 'SpawnResponse' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class SpawnResponse + { + [CandidName("created_neuron_id")] + public OptionalValue CreatedNeuronId { get; set; } + + public SpawnResponse(OptionalValue createdNeuronId) + { + this.CreatedNeuronId = createdNeuronId; + } + + public SpawnResponse() + { + } + } +} + +Type File: 'Split' + +using EdjCase.ICP.Candid.Mapping; + +namespace Test +{ + public class Split + { + [CandidName("amount_e8s")] + public ulong AmountE8s { get; set; } + + public Split(ulong amountE8s) + { + this.AmountE8s = amountE8s; + } + + public Split() + { + } + } +} + +Type File: 'Tally' + +using EdjCase.ICP.Candid.Mapping; + +namespace Test +{ + public class Tally + { + [CandidName("no")] + public ulong No { get; set; } + + [CandidName("yes")] + public ulong Yes { get; set; } + + [CandidName("total")] + public ulong Total { get; set; } + + [CandidName("timestamp_seconds")] + public ulong TimestampSeconds { get; set; } + + public Tally(ulong no, ulong yes, ulong total, ulong timestampSeconds) + { + this.No = no; + this.Yes = yes; + this.Total = total; + this.TimestampSeconds = timestampSeconds; + } + + public Tally() + { + } + } +} + +Type File: 'UpdateNodeProvider' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class UpdateNodeProvider + { + [CandidName("reward_account")] + public OptionalValue RewardAccount { get; set; } + + public UpdateNodeProvider(OptionalValue rewardAccount) + { + this.RewardAccount = rewardAccount; + } + + public UpdateNodeProvider() + { + } + } +} + +Type File: 'WaitForQuietState' + +using EdjCase.ICP.Candid.Mapping; + +namespace Test +{ + public class WaitForQuietState + { + [CandidName("current_deadline_timestamp_seconds")] + public ulong CurrentDeadlineTimestampSeconds { get; set; } + + public WaitForQuietState(ulong currentDeadlineTimestampSeconds) + { + this.CurrentDeadlineTimestampSeconds = currentDeadlineTimestampSeconds; + } + + public WaitForQuietState() + { + } + } +} diff --git a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_False_KeepCandidCase_True.snap b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False.snap similarity index 95% rename from test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_False_KeepCandidCase_True.snap rename to test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False.snap index 2d7dbb65..9e60204e 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_False_KeepCandidCase_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_False.snap @@ -208,7 +208,7 @@ using System; namespace Test { - [Variant(typeof(ActionTag))] + [Variant()] public class Action { [VariantTagProperty()] @@ -348,25 +348,15 @@ namespace Test public enum ActionTag { - [VariantOptionType(typeof(KnownNeuron))] RegisterKnownNeuron, - [VariantOptionType(typeof(ManageNeuron))] ManageNeuron, - [VariantOptionType(typeof(ExecuteNnsFunction))] ExecuteNnsFunction, - [VariantOptionType(typeof(RewardNodeProvider))] RewardNodeProvider, - [VariantOptionType(typeof(SetDefaultFollowees))] SetDefaultFollowees, - [VariantOptionType(typeof(RewardNodeProviders))] RewardNodeProviders, - [VariantOptionType(typeof(NetworkEconomics))] ManageNetworkEconomics, - [VariantOptionType(typeof(ApproveGenesisKyc))] ApproveGenesisKyc, - [VariantOptionType(typeof(AddOrRemoveNodeProvider))] AddOrRemoveNodeProvider, - [VariantOptionType(typeof(Motion))] Motion } } @@ -510,7 +500,7 @@ using System; namespace Test { - [Variant(typeof(ByTag))] + [Variant()] public class By { [VariantTagProperty()] @@ -580,11 +570,8 @@ namespace Test public enum ByTag { - [VariantOptionType(typeof(By.NeuronIdOrSubaccountInfo))] NeuronIdOrSubaccount, - [VariantOptionType(typeof(ClaimOrRefreshNeuronFromAccount))] MemoAndController, - [VariantOptionType(typeof(ulong))] Memo } } @@ -597,7 +584,7 @@ using System; namespace Test { - [Variant(typeof(ChangeTag))] + [Variant()] public class Change { [VariantTagProperty()] @@ -649,9 +636,7 @@ namespace Test public enum ChangeTag { - [VariantOptionType(typeof(NodeProvider))] ToRemove, - [VariantOptionType(typeof(NodeProvider))] ToAdd } } @@ -754,7 +739,7 @@ using System; namespace Test { - [Variant(typeof(CommandTag))] + [Variant()] public class Command { [VariantTagProperty()] @@ -905,27 +890,16 @@ namespace Test public enum CommandTag { - [VariantOptionType(typeof(Spawn))] Spawn, - [VariantOptionType(typeof(Split))] Split, - [VariantOptionType(typeof(Follow))] Follow, - [VariantOptionType(typeof(ClaimOrRefresh))] ClaimOrRefresh, - [VariantOptionType(typeof(Configure))] Configure, - [VariantOptionType(typeof(RegisterVote))] RegisterVote, - [VariantOptionType(typeof(Merge))] Merge, - [VariantOptionType(typeof(DisburseToNeuron))] DisburseToNeuron, - [VariantOptionType(typeof(Proposal))] MakeProposal, - [VariantOptionType(typeof(MergeMaturity))] MergeMaturity, - [VariantOptionType(typeof(Disburse))] Disburse } } @@ -938,7 +912,7 @@ using System; namespace Test { - [Variant(typeof(Command_1Tag))] + [Variant()] public class Command_1 { [VariantTagProperty()] @@ -1128,29 +1102,17 @@ namespace Test public enum Command_1Tag { - [VariantOptionType(typeof(GovernanceError))] Error, - [VariantOptionType(typeof(SpawnResponse))] Spawn, - [VariantOptionType(typeof(SpawnResponse))] Split, - [VariantOptionType(typeof(Command_1.FollowInfo))] Follow, - [VariantOptionType(typeof(ClaimOrRefreshResponse))] ClaimOrRefresh, - [VariantOptionType(typeof(Command_1.ConfigureInfo))] Configure, - [VariantOptionType(typeof(Command_1.RegisterVoteInfo))] RegisterVote, - [VariantOptionType(typeof(Command_1.MergeInfo))] Merge, - [VariantOptionType(typeof(SpawnResponse))] DisburseToNeuron, - [VariantOptionType(typeof(MakeProposalResponse))] MakeProposal, - [VariantOptionType(typeof(MergeMaturityResponse))] MergeMaturity, - [VariantOptionType(typeof(DisburseResponse))] Disburse } } @@ -1163,7 +1125,7 @@ using System; namespace Test { - [Variant(typeof(Command_2Tag))] + [Variant()] public class Command_2 { [VariantTagProperty()] @@ -1281,21 +1243,13 @@ namespace Test public enum Command_2Tag { - [VariantOptionType(typeof(Spawn))] Spawn, - [VariantOptionType(typeof(Split))] Split, - [VariantOptionType(typeof(Configure))] Configure, - [VariantOptionType(typeof(Merge))] Merge, - [VariantOptionType(typeof(DisburseToNeuron))] DisburseToNeuron, - [VariantOptionType(typeof(ClaimOrRefresh))] ClaimOrRefreshNeuron, - [VariantOptionType(typeof(MergeMaturity))] MergeMaturity, - [VariantOptionType(typeof(Disburse))] Disburse } } @@ -1407,7 +1361,7 @@ using System; namespace Test { - [Variant(typeof(DissolveStateTag))] + [Variant()] public class DissolveState { [VariantTagProperty()] @@ -1459,9 +1413,7 @@ namespace Test public enum DissolveStateTag { - [VariantOptionType(typeof(ulong))] DissolveDelaySeconds, - [VariantOptionType(typeof(ulong))] WhenDissolvedTimestampSeconds } } @@ -2192,7 +2144,7 @@ using System; namespace Test { - [Variant(typeof(NeuronIdOrSubaccountTag))] + [Variant()] public class NeuronIdOrSubaccount { [VariantTagProperty()] @@ -2244,9 +2196,7 @@ namespace Test public enum NeuronIdOrSubaccountTag { - [VariantOptionType(typeof(List))] Subaccount, - [VariantOptionType(typeof(NeuronId))] NeuronId } } @@ -2399,7 +2349,7 @@ using System; namespace Test { - [Variant(typeof(OperationTag))] + [Variant()] public class Operation { [VariantTagProperty()] @@ -2527,19 +2477,12 @@ namespace Test public enum OperationTag { - [VariantOptionType(typeof(RemoveHotKey))] RemoveHotKey, - [VariantOptionType(typeof(AddHotKey))] AddHotKey, - [VariantOptionType(typeof(Operation.StopDissolvingInfo))] StopDissolving, - [VariantOptionType(typeof(Operation.StartDissolvingInfo))] StartDissolving, - [VariantOptionType(typeof(IncreaseDissolveDelay))] IncreaseDissolveDelay, - [VariantOptionType(typeof(Operation.JoinCommunityFundInfo))] JoinCommunityFund, - [VariantOptionType(typeof(SetDissolveTimestamp))] SetDissolveTimestamp } } @@ -2756,7 +2699,7 @@ using System; namespace Test { - [Variant(typeof(ResultTag))] + [Variant()] public class Result { [VariantTagProperty()] @@ -2803,7 +2746,6 @@ namespace Test public enum ResultTag { Ok, - [VariantOptionType(typeof(GovernanceError))] Err } } @@ -2816,7 +2758,7 @@ using System; namespace Test { - [Variant(typeof(Result_1Tag))] + [Variant()] public class Result_1 { [VariantTagProperty()] @@ -2868,9 +2810,7 @@ namespace Test public enum Result_1Tag { - [VariantOptionType(typeof(GovernanceError))] Error, - [VariantOptionType(typeof(NeuronId))] NeuronId } } @@ -2883,7 +2823,7 @@ using System; namespace Test { - [Variant(typeof(Result_2Tag))] + [Variant()] public class Result_2 { [VariantTagProperty()] @@ -2935,9 +2875,7 @@ namespace Test public enum Result_2Tag { - [VariantOptionType(typeof(Neuron))] Ok, - [VariantOptionType(typeof(GovernanceError))] Err } } @@ -2950,7 +2888,7 @@ using System; namespace Test { - [Variant(typeof(Result_3Tag))] + [Variant()] public class Result_3 { [VariantTagProperty()] @@ -3002,9 +2940,7 @@ namespace Test public enum Result_3Tag { - [VariantOptionType(typeof(RewardNodeProviders))] Ok, - [VariantOptionType(typeof(GovernanceError))] Err } } @@ -3017,7 +2953,7 @@ using System; namespace Test { - [Variant(typeof(Result_4Tag))] + [Variant()] public class Result_4 { [VariantTagProperty()] @@ -3069,9 +3005,7 @@ namespace Test public enum Result_4Tag { - [VariantOptionType(typeof(NeuronInfo))] Ok, - [VariantOptionType(typeof(GovernanceError))] Err } } @@ -3084,7 +3018,7 @@ using System; namespace Test { - [Variant(typeof(Result_5Tag))] + [Variant()] public class Result_5 { [VariantTagProperty()] @@ -3136,9 +3070,7 @@ namespace Test public enum Result_5Tag { - [VariantOptionType(typeof(NodeProvider))] Ok, - [VariantOptionType(typeof(GovernanceError))] Err } } @@ -3182,7 +3114,7 @@ using System; namespace Test { - [Variant(typeof(RewardModeTag))] + [Variant()] public class RewardMode { [VariantTagProperty()] @@ -3234,9 +3166,7 @@ namespace Test public enum RewardModeTag { - [VariantOptionType(typeof(RewardToNeuron))] RewardToNeuron, - [VariantOptionType(typeof(RewardToAccount))] RewardToAccount } } diff --git a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True.snap b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True.snap new file mode 100644 index 00000000..965926cb --- /dev/null +++ b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_False_KeepCandidCase_True_VariantsUseProperties_True.snap @@ -0,0 +1,2666 @@ +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 +{ + public class GovernanceApiClient + { + public IAgent Agent { get; } + + public Principal CanisterId { get; } + + public CandidConverter Converter { get; } + + public GovernanceApiClient(IAgent agent, Principal canisterId, CandidConverter converter = default) + { + this.Agent = agent; + this.CanisterId = canisterId; + this.Converter = converter; + } + + public async Task claim_gtc_neurons(Principal arg0, List arg1) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0), CandidTypedValue.FromObject(arg1)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "claim_gtc_neurons", arg); + return reply.ToObjects(this.Converter); + } + + public async Task claim_or_refresh_neuron_from_account(ClaimOrRefreshNeuronFromAccount arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "claim_or_refresh_neuron_from_account", arg); + return reply.ToObjects(this.Converter); + } + + 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(); + return reply.ToObjects(this.Converter); + } + + public async Task _get_full_neuron(ulong arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + + public async Task _get_full_neuron_by_id_or_subaccount(NeuronIdOrSubaccount arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron_by_id_or_subaccount", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + + public async Task _get_monthly_node_provider_rewards() + { + CandidArg arg = CandidArg.FromCandid(); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "get_monthly_node_provider_rewards", arg); + return reply.ToObjects(this.Converter); + } + + 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(); + 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(); + return reply.ToObjects>(this.Converter); + } + + public async Task _get_neuron_info(ulong arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + + public async Task _get_neuron_info_by_id_or_subaccount(NeuronIdOrSubaccount arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info_by_id_or_subaccount", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + + public async Task _get_node_provider_by_caller(NullValue arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_node_provider_by_caller", arg); + CandidArg reply = response.ThrowOrGetReply(); + 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(); + return reply.ToObjects>(this.Converter); + } + + public async Task> _get_proposal_info(ulong arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_proposal_info", arg); + CandidArg reply = response.ThrowOrGetReply(); + 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(); + return reply.ToObjects(this.Converter); + } + + public async Task list_neurons(ListNeurons arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_neurons", arg); + CandidArg reply = response.ThrowOrGetReply(); + 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(); + return reply.ToObjects(this.Converter); + } + + public async Task list_proposals(ListProposalInfo arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_proposals", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + + public async Task manage_neuron(ManageNeuron arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "manage_neuron", arg); + return reply.ToObjects(this.Converter); + } + + public async Task transfer_gtc_neuron(NeuronId arg0, NeuronId arg1) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0), CandidTypedValue.FromObject(arg1)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "transfer_gtc_neuron", arg); + return reply.ToObjects(this.Converter); + } + + public async Task update_node_provider(UpdateNodeProvider arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "update_node_provider", arg); + return reply.ToObjects(this.Converter); + } + } +} + +Type File: 'AccountIdentifier' + +using System.Collections.Generic; + +namespace Test +{ + public class AccountIdentifier + { + public List hash { get; set; } + + public AccountIdentifier(List hash) + { + this.hash = hash; + } + + public AccountIdentifier() + { + } + } +} + +Type File: 'Action' + +using EdjCase.ICP.Candid.Mapping; +using Test; + +namespace Test +{ + [Variant()] + public class Action + { + [VariantTagProperty()] + public ActionTag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public KnownNeuron RegisterKnownNeuron { get => this.Tag == ActionTag.RegisterKnownNeuron ? (KnownNeuron)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.RegisterKnownNeuron, value); } + + public ManageNeuron ManageNeuron { get => this.Tag == ActionTag.ManageNeuron ? (ManageNeuron)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.ManageNeuron, value); } + + public ExecuteNnsFunction ExecuteNnsFunction { get => this.Tag == ActionTag.ExecuteNnsFunction ? (ExecuteNnsFunction)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.ExecuteNnsFunction, value); } + + public RewardNodeProvider RewardNodeProvider { get => this.Tag == ActionTag.RewardNodeProvider ? (RewardNodeProvider)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.RewardNodeProvider, value); } + + public SetDefaultFollowees SetDefaultFollowees { get => this.Tag == ActionTag.SetDefaultFollowees ? (SetDefaultFollowees)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.SetDefaultFollowees, value); } + + public RewardNodeProviders RewardNodeProviders { get => this.Tag == ActionTag.RewardNodeProviders ? (RewardNodeProviders)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.RewardNodeProviders, value); } + + public NetworkEconomics ManageNetworkEconomics { get => this.Tag == ActionTag.ManageNetworkEconomics ? (NetworkEconomics)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.ManageNetworkEconomics, value); } + + public ApproveGenesisKyc ApproveGenesisKyc { get => this.Tag == ActionTag.ApproveGenesisKyc ? (ApproveGenesisKyc)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.ApproveGenesisKyc, value); } + + public AddOrRemoveNodeProvider AddOrRemoveNodeProvider { get => this.Tag == ActionTag.AddOrRemoveNodeProvider ? (AddOrRemoveNodeProvider)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.AddOrRemoveNodeProvider, value); } + + public Motion Motion { get => this.Tag == ActionTag.Motion ? (Motion)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.Motion, value); } + + public Action(ActionTag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected Action() + { + } + } + + public enum ActionTag + { + RegisterKnownNeuron, + ManageNeuron, + ExecuteNnsFunction, + RewardNodeProvider, + SetDefaultFollowees, + RewardNodeProviders, + ManageNetworkEconomics, + ApproveGenesisKyc, + AddOrRemoveNodeProvider, + Motion + } +} + +Type File: 'AddHotKey' + +using EdjCase.ICP.Candid.Models; + +namespace Test +{ + public class AddHotKey + { + public OptionalValue new_hot_key { get; set; } + + public AddHotKey(OptionalValue newHotKey) + { + this.new_hot_key = newHotKey; + } + + public AddHotKey() + { + } + } +} + +Type File: 'AddOrRemoveNodeProvider' + +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class AddOrRemoveNodeProvider + { + public OptionalValue change { get; set; } + + public AddOrRemoveNodeProvider(OptionalValue change) + { + this.change = change; + } + + public AddOrRemoveNodeProvider() + { + } + } +} + +Type File: 'Amount' + +namespace Test +{ + public class Amount + { + public ulong e8s { get; set; } + + public Amount(ulong e8s) + { + this.e8s = e8s; + } + + public Amount() + { + } + } +} + +Type File: 'ApproveGenesisKyc' + +using System.Collections.Generic; +using EdjCase.ICP.Candid.Models; + +namespace Test +{ + public class ApproveGenesisKyc + { + public List principals { get; set; } + + public ApproveGenesisKyc(List principals) + { + this.principals = principals; + } + + public ApproveGenesisKyc() + { + } + } +} + +Type File: 'Ballot' + +namespace Test +{ + public class Ballot + { + public int vote { get; set; } + + public ulong voting_power { get; set; } + + public Ballot(int vote, ulong votingPower) + { + this.vote = vote; + this.voting_power = votingPower; + } + + public Ballot() + { + } + } +} + +Type File: 'BallotInfo' + +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class BallotInfo + { + public int vote { get; set; } + + public OptionalValue proposal_id { get; set; } + + public BallotInfo(int vote, OptionalValue proposalId) + { + this.vote = vote; + this.proposal_id = proposalId; + } + + public BallotInfo() + { + } + } +} + +Type File: 'By' + +using EdjCase.ICP.Candid.Mapping; +using Test; + +namespace Test +{ + [Variant()] + public class By + { + [VariantTagProperty()] + public ByTag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public By.NeuronIdOrSubaccountInfo NeuronIdOrSubaccount { get => this.Tag == ByTag.NeuronIdOrSubaccount ? (By.NeuronIdOrSubaccountInfo)this.Value! : default; set => (this.Tag, this.Value) = (ByTag.NeuronIdOrSubaccount, value); } + + public ClaimOrRefreshNeuronFromAccount MemoAndController { get => this.Tag == ByTag.MemoAndController ? (ClaimOrRefreshNeuronFromAccount)this.Value! : default; set => (this.Tag, this.Value) = (ByTag.MemoAndController, value); } + + public ulong Memo { get => this.Tag == ByTag.Memo ? (ulong)this.Value! : default; set => (this.Tag, this.Value) = (ByTag.Memo, value); } + + public By(ByTag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected By() + { + } + + public class NeuronIdOrSubaccountInfo + { + public NeuronIdOrSubaccountInfo() + { + } + } + } + + public enum ByTag + { + NeuronIdOrSubaccount, + MemoAndController, + Memo + } +} + +Type File: 'Change' + +using EdjCase.ICP.Candid.Mapping; +using Test; + +namespace Test +{ + [Variant()] + public class Change + { + [VariantTagProperty()] + public ChangeTag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public NodeProvider ToRemove { get => this.Tag == ChangeTag.ToRemove ? (NodeProvider)this.Value! : default; set => (this.Tag, this.Value) = (ChangeTag.ToRemove, value); } + + public NodeProvider ToAdd { get => this.Tag == ChangeTag.ToAdd ? (NodeProvider)this.Value! : default; set => (this.Tag, this.Value) = (ChangeTag.ToAdd, value); } + + public Change(ChangeTag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected Change() + { + } + } + + public enum ChangeTag + { + ToRemove, + ToAdd + } +} + +Type File: 'ClaimOrRefresh' + +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class ClaimOrRefresh + { + public OptionalValue by { get; set; } + + public ClaimOrRefresh(OptionalValue by) + { + this.by = by; + } + + public ClaimOrRefresh() + { + } + } +} + +Type File: 'ClaimOrRefreshNeuronFromAccount' + +using EdjCase.ICP.Candid.Models; + +namespace Test +{ + public class ClaimOrRefreshNeuronFromAccount + { + public OptionalValue controller { get; set; } + + public ulong memo { get; set; } + + public ClaimOrRefreshNeuronFromAccount(OptionalValue controller, ulong memo) + { + this.controller = controller; + this.memo = memo; + } + + public ClaimOrRefreshNeuronFromAccount() + { + } + } +} + +Type File: 'ClaimOrRefreshNeuronFromAccountResponse' + +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class ClaimOrRefreshNeuronFromAccountResponse + { + public OptionalValue result { get; set; } + + public ClaimOrRefreshNeuronFromAccountResponse(OptionalValue result) + { + this.result = result; + } + + public ClaimOrRefreshNeuronFromAccountResponse() + { + } + } +} + +Type File: 'ClaimOrRefreshResponse' + +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class ClaimOrRefreshResponse + { + public OptionalValue refreshed_neuron_id { get; set; } + + public ClaimOrRefreshResponse(OptionalValue refreshedNeuronId) + { + this.refreshed_neuron_id = refreshedNeuronId; + } + + public ClaimOrRefreshResponse() + { + } + } +} + +Type File: 'Command' + +using EdjCase.ICP.Candid.Mapping; +using Test; + +namespace Test +{ + [Variant()] + public class Command + { + [VariantTagProperty()] + public CommandTag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public Spawn Spawn { get => this.Tag == CommandTag.Spawn ? (Spawn)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.Spawn, value); } + + public Split Split { get => this.Tag == CommandTag.Split ? (Split)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.Split, value); } + + public Follow Follow { get => this.Tag == CommandTag.Follow ? (Follow)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.Follow, value); } + + public ClaimOrRefresh ClaimOrRefresh { get => this.Tag == CommandTag.ClaimOrRefresh ? (ClaimOrRefresh)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.ClaimOrRefresh, value); } + + public Configure Configure { get => this.Tag == CommandTag.Configure ? (Configure)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.Configure, value); } + + public RegisterVote RegisterVote { get => this.Tag == CommandTag.RegisterVote ? (RegisterVote)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.RegisterVote, value); } + + public Merge Merge { get => this.Tag == CommandTag.Merge ? (Merge)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.Merge, value); } + + public DisburseToNeuron DisburseToNeuron { get => this.Tag == CommandTag.DisburseToNeuron ? (DisburseToNeuron)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.DisburseToNeuron, value); } + + public Proposal MakeProposal { get => this.Tag == CommandTag.MakeProposal ? (Proposal)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.MakeProposal, value); } + + public MergeMaturity MergeMaturity { get => this.Tag == CommandTag.MergeMaturity ? (MergeMaturity)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.MergeMaturity, value); } + + public Disburse Disburse { get => this.Tag == CommandTag.Disburse ? (Disburse)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.Disburse, value); } + + public Command(CommandTag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected Command() + { + } + } + + public enum CommandTag + { + Spawn, + Split, + Follow, + ClaimOrRefresh, + Configure, + RegisterVote, + Merge, + DisburseToNeuron, + MakeProposal, + MergeMaturity, + Disburse + } +} + +Type File: 'Command_1' + +using EdjCase.ICP.Candid.Mapping; +using Test; + +namespace Test +{ + [Variant()] + public class Command_1 + { + [VariantTagProperty()] + public Command_1Tag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public GovernanceError Error { get => this.Tag == Command_1Tag.Error ? (GovernanceError)this.Value! : default; set => (this.Tag, this.Value) = (Command_1Tag.Error, value); } + + public SpawnResponse Spawn { get => this.Tag == Command_1Tag.Spawn ? (SpawnResponse)this.Value! : default; set => (this.Tag, this.Value) = (Command_1Tag.Spawn, value); } + + public SpawnResponse Split { get => this.Tag == Command_1Tag.Split ? (SpawnResponse)this.Value! : default; set => (this.Tag, this.Value) = (Command_1Tag.Split, value); } + + public Command_1.FollowInfo Follow { get => this.Tag == Command_1Tag.Follow ? (Command_1.FollowInfo)this.Value! : default; set => (this.Tag, this.Value) = (Command_1Tag.Follow, value); } + + public ClaimOrRefreshResponse ClaimOrRefresh { get => this.Tag == Command_1Tag.ClaimOrRefresh ? (ClaimOrRefreshResponse)this.Value! : default; set => (this.Tag, this.Value) = (Command_1Tag.ClaimOrRefresh, value); } + + public Command_1.ConfigureInfo Configure { get => this.Tag == Command_1Tag.Configure ? (Command_1.ConfigureInfo)this.Value! : default; set => (this.Tag, this.Value) = (Command_1Tag.Configure, value); } + + public Command_1.RegisterVoteInfo RegisterVote { get => this.Tag == Command_1Tag.RegisterVote ? (Command_1.RegisterVoteInfo)this.Value! : default; set => (this.Tag, this.Value) = (Command_1Tag.RegisterVote, value); } + + public Command_1.MergeInfo Merge { get => this.Tag == Command_1Tag.Merge ? (Command_1.MergeInfo)this.Value! : default; set => (this.Tag, this.Value) = (Command_1Tag.Merge, value); } + + public SpawnResponse DisburseToNeuron { get => this.Tag == Command_1Tag.DisburseToNeuron ? (SpawnResponse)this.Value! : default; set => (this.Tag, this.Value) = (Command_1Tag.DisburseToNeuron, value); } + + public MakeProposalResponse MakeProposal { get => this.Tag == Command_1Tag.MakeProposal ? (MakeProposalResponse)this.Value! : default; set => (this.Tag, this.Value) = (Command_1Tag.MakeProposal, value); } + + public MergeMaturityResponse MergeMaturity { get => this.Tag == Command_1Tag.MergeMaturity ? (MergeMaturityResponse)this.Value! : default; set => (this.Tag, this.Value) = (Command_1Tag.MergeMaturity, value); } + + public DisburseResponse Disburse { get => this.Tag == Command_1Tag.Disburse ? (DisburseResponse)this.Value! : default; set => (this.Tag, this.Value) = (Command_1Tag.Disburse, value); } + + public Command_1(Command_1Tag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected Command_1() + { + } + + public class FollowInfo + { + public FollowInfo() + { + } + } + + public class ConfigureInfo + { + public ConfigureInfo() + { + } + } + + public class RegisterVoteInfo + { + public RegisterVoteInfo() + { + } + } + + public class MergeInfo + { + public MergeInfo() + { + } + } + } + + public enum Command_1Tag + { + Error, + Spawn, + Split, + Follow, + ClaimOrRefresh, + Configure, + RegisterVote, + Merge, + DisburseToNeuron, + MakeProposal, + MergeMaturity, + Disburse + } +} + +Type File: 'Command_2' + +using EdjCase.ICP.Candid.Mapping; +using Test; + +namespace Test +{ + [Variant()] + public class Command_2 + { + [VariantTagProperty()] + public Command_2Tag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public Spawn Spawn { get => this.Tag == Command_2Tag.Spawn ? (Spawn)this.Value! : default; set => (this.Tag, this.Value) = (Command_2Tag.Spawn, value); } + + public Split Split { get => this.Tag == Command_2Tag.Split ? (Split)this.Value! : default; set => (this.Tag, this.Value) = (Command_2Tag.Split, value); } + + public Configure Configure { get => this.Tag == Command_2Tag.Configure ? (Configure)this.Value! : default; set => (this.Tag, this.Value) = (Command_2Tag.Configure, value); } + + public Merge Merge { get => this.Tag == Command_2Tag.Merge ? (Merge)this.Value! : default; set => (this.Tag, this.Value) = (Command_2Tag.Merge, value); } + + public DisburseToNeuron DisburseToNeuron { get => this.Tag == Command_2Tag.DisburseToNeuron ? (DisburseToNeuron)this.Value! : default; set => (this.Tag, this.Value) = (Command_2Tag.DisburseToNeuron, value); } + + public ClaimOrRefresh ClaimOrRefreshNeuron { get => this.Tag == Command_2Tag.ClaimOrRefreshNeuron ? (ClaimOrRefresh)this.Value! : default; set => (this.Tag, this.Value) = (Command_2Tag.ClaimOrRefreshNeuron, value); } + + public MergeMaturity MergeMaturity { get => this.Tag == Command_2Tag.MergeMaturity ? (MergeMaturity)this.Value! : default; set => (this.Tag, this.Value) = (Command_2Tag.MergeMaturity, value); } + + public Disburse Disburse { get => this.Tag == Command_2Tag.Disburse ? (Disburse)this.Value! : default; set => (this.Tag, this.Value) = (Command_2Tag.Disburse, value); } + + public Command_2(Command_2Tag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected Command_2() + { + } + } + + public enum Command_2Tag + { + Spawn, + Split, + Configure, + Merge, + DisburseToNeuron, + ClaimOrRefreshNeuron, + MergeMaturity, + Disburse + } +} + +Type File: 'Configure' + +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class Configure + { + public OptionalValue operation { get; set; } + + public Configure(OptionalValue operation) + { + this.operation = operation; + } + + public Configure() + { + } + } +} + +Type File: 'Disburse' + +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class Disburse + { + public OptionalValue to_account { get; set; } + + public OptionalValue amount { get; set; } + + public Disburse(OptionalValue toAccount, OptionalValue amount) + { + this.to_account = toAccount; + this.amount = amount; + } + + public Disburse() + { + } + } +} + +Type File: 'DisburseResponse' + +namespace Test +{ + public class DisburseResponse + { + public ulong transfer_block_height { get; set; } + + public DisburseResponse(ulong transferBlockHeight) + { + this.transfer_block_height = transferBlockHeight; + } + + public DisburseResponse() + { + } + } +} + +Type File: 'DisburseToNeuron' + +using EdjCase.ICP.Candid.Models; + +namespace Test +{ + public class DisburseToNeuron + { + public ulong dissolve_delay_seconds { get; set; } + + public bool kyc_verified { get; set; } + + public ulong amount_e8s { get; set; } + + public OptionalValue new_controller { get; set; } + + public ulong nonce { get; set; } + + public DisburseToNeuron(ulong dissolveDelaySeconds, bool kycVerified, ulong amountE8s, OptionalValue newController, ulong nonce) + { + this.dissolve_delay_seconds = dissolveDelaySeconds; + this.kyc_verified = kycVerified; + this.amount_e8s = amountE8s; + this.new_controller = newController; + this.nonce = nonce; + } + + public DisburseToNeuron() + { + } + } +} + +Type File: 'DissolveState' + +using EdjCase.ICP.Candid.Mapping; +using Test; + +namespace Test +{ + [Variant()] + public class DissolveState + { + [VariantTagProperty()] + public DissolveStateTag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public ulong DissolveDelaySeconds { get => this.Tag == DissolveStateTag.DissolveDelaySeconds ? (ulong)this.Value! : default; set => (this.Tag, this.Value) = (DissolveStateTag.DissolveDelaySeconds, value); } + + public ulong WhenDissolvedTimestampSeconds { get => this.Tag == DissolveStateTag.WhenDissolvedTimestampSeconds ? (ulong)this.Value! : default; set => (this.Tag, this.Value) = (DissolveStateTag.WhenDissolvedTimestampSeconds, value); } + + public DissolveState(DissolveStateTag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected DissolveState() + { + } + } + + public enum DissolveStateTag + { + DissolveDelaySeconds, + WhenDissolvedTimestampSeconds + } +} + +Type File: 'ExecuteNnsFunction' + +using System.Collections.Generic; + +namespace Test +{ + public class ExecuteNnsFunction + { + public int nns_function { get; set; } + + public List payload { get; set; } + + public ExecuteNnsFunction(int nnsFunction, List payload) + { + this.nns_function = nnsFunction; + this.payload = payload; + } + + public ExecuteNnsFunction() + { + } + } +} + +Type File: 'Follow' + +using System.Collections.Generic; +using Test; + +namespace Test +{ + public class Follow + { + public int topic { get; set; } + + public List followees { get; set; } + + public Follow(int topic, List followees) + { + this.topic = topic; + this.followees = followees; + } + + public Follow() + { + } + } +} + +Type File: 'Followees' + +using System.Collections.Generic; +using Test; + +namespace Test +{ + public class Followees + { + public List followees { get; set; } + + public Followees(List followees) + { + this.followees = followees; + } + + public Followees() + { + } + } +} + +Type File: 'Governance' + +using System.Collections.Generic; +using Test; +using EdjCase.ICP.Candid.Models; + +namespace Test +{ + public class Governance + { + public Dictionary default_followees { get; set; } + + public ulong wait_for_quiet_threshold_seconds { get; set; } + + public OptionalValue metrics { get; set; } + + public List node_providers { get; set; } + + public OptionalValue economics { get; set; } + + public OptionalValue latest_reward_event { get; set; } + + public List to_claim_transfers { get; set; } + + public ulong short_voting_period_seconds { get; set; } + + public Dictionary proposals { get; set; } + + public Dictionary in_flight_commands { get; set; } + + public Dictionary neurons { get; set; } + + public ulong genesis_timestamp_seconds { get; set; } + + public Governance(Dictionary defaultFollowees, ulong waitForQuietThresholdSeconds, OptionalValue metrics, List nodeProviders, OptionalValue economics, OptionalValue latestRewardEvent, List toClaimTransfers, ulong shortVotingPeriodSeconds, Dictionary proposals, Dictionary inFlightCommands, Dictionary neurons, ulong genesisTimestampSeconds) + { + this.default_followees = defaultFollowees; + this.wait_for_quiet_threshold_seconds = waitForQuietThresholdSeconds; + this.metrics = metrics; + this.node_providers = nodeProviders; + this.economics = economics; + this.latest_reward_event = latestRewardEvent; + this.to_claim_transfers = toClaimTransfers; + this.short_voting_period_seconds = shortVotingPeriodSeconds; + this.proposals = proposals; + this.in_flight_commands = inFlightCommands; + this.neurons = neurons; + this.genesis_timestamp_seconds = genesisTimestampSeconds; + } + + public Governance() + { + } + } +} + +Type File: 'GovernanceCachedMetrics' + +using System.Collections.Generic; + +namespace Test +{ + public class GovernanceCachedMetrics + { + public Dictionary not_dissolving_neurons_e8s_buckets { get; set; } + + public ulong garbage_collectable_neurons_count { get; set; } + + public ulong neurons_with_invalid_stake_count { get; set; } + + public Dictionary not_dissolving_neurons_count_buckets { get; set; } + + public ulong total_supply_icp { get; set; } + + public ulong neurons_with_less_than_6_months_dissolve_delay_count { get; set; } + + public ulong dissolved_neurons_count { get; set; } + + public ulong total_staked_e8s { get; set; } + + public ulong not_dissolving_neurons_count { get; set; } + + public ulong dissolved_neurons_e8s { get; set; } + + public ulong neurons_with_less_than_6_months_dissolve_delay_e8s { get; set; } + + public Dictionary dissolving_neurons_count_buckets { get; set; } + + public ulong dissolving_neurons_count { get; set; } + + public Dictionary dissolving_neurons_e8s_buckets { get; set; } + + public ulong community_fund_total_staked_e8s { get; set; } + + public ulong timestamp_seconds { get; set; } + + public GovernanceCachedMetrics(Dictionary notDissolvingNeuronsE8sBuckets, ulong garbageCollectableNeuronsCount, ulong neuronsWithInvalidStakeCount, Dictionary notDissolvingNeuronsCountBuckets, ulong totalSupplyIcp, ulong neuronsWithLessThan6MonthsDissolveDelayCount, ulong dissolvedNeuronsCount, ulong totalStakedE8s, ulong notDissolvingNeuronsCount, ulong dissolvedNeuronsE8s, ulong neuronsWithLessThan6MonthsDissolveDelayE8s, Dictionary dissolvingNeuronsCountBuckets, ulong dissolvingNeuronsCount, Dictionary dissolvingNeuronsE8sBuckets, ulong communityFundTotalStakedE8s, ulong timestampSeconds) + { + this.not_dissolving_neurons_e8s_buckets = notDissolvingNeuronsE8sBuckets; + this.garbage_collectable_neurons_count = garbageCollectableNeuronsCount; + this.neurons_with_invalid_stake_count = neuronsWithInvalidStakeCount; + this.not_dissolving_neurons_count_buckets = notDissolvingNeuronsCountBuckets; + this.total_supply_icp = totalSupplyIcp; + this.neurons_with_less_than_6_months_dissolve_delay_count = neuronsWithLessThan6MonthsDissolveDelayCount; + this.dissolved_neurons_count = dissolvedNeuronsCount; + this.total_staked_e8s = totalStakedE8s; + this.not_dissolving_neurons_count = notDissolvingNeuronsCount; + this.dissolved_neurons_e8s = dissolvedNeuronsE8s; + this.neurons_with_less_than_6_months_dissolve_delay_e8s = neuronsWithLessThan6MonthsDissolveDelayE8s; + this.dissolving_neurons_count_buckets = dissolvingNeuronsCountBuckets; + this.dissolving_neurons_count = dissolvingNeuronsCount; + this.dissolving_neurons_e8s_buckets = dissolvingNeuronsE8sBuckets; + this.community_fund_total_staked_e8s = communityFundTotalStakedE8s; + this.timestamp_seconds = timestampSeconds; + } + + public GovernanceCachedMetrics() + { + } + } +} + +Type File: 'GovernanceError' + +namespace Test +{ + public class GovernanceError + { + public string error_message { get; set; } + + public int error_type { get; set; } + + public GovernanceError(string errorMessage, int errorType) + { + this.error_message = errorMessage; + this.error_type = errorType; + } + + public GovernanceError() + { + } + } +} + +Type File: 'IncreaseDissolveDelay' + +namespace Test +{ + public class IncreaseDissolveDelay + { + public uint additional_dissolve_delay_seconds { get; set; } + + public IncreaseDissolveDelay(uint additionalDissolveDelaySeconds) + { + this.additional_dissolve_delay_seconds = additionalDissolveDelaySeconds; + } + + public IncreaseDissolveDelay() + { + } + } +} + +Type File: 'KnownNeuron' + +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class KnownNeuron + { + public OptionalValue id { get; set; } + + public OptionalValue known_neuron_data { get; set; } + + public KnownNeuron(OptionalValue id, OptionalValue knownNeuronData) + { + this.id = id; + this.known_neuron_data = knownNeuronData; + } + + public KnownNeuron() + { + } + } +} + +Type File: 'KnownNeuronData' + +using EdjCase.ICP.Candid.Models; + +namespace Test +{ + public class KnownNeuronData + { + public string name { get; set; } + + public OptionalValue description { get; set; } + + public KnownNeuronData(string name, OptionalValue description) + { + this.name = name; + this.description = description; + } + + public KnownNeuronData() + { + } + } +} + +Type File: 'ListKnownNeuronsResponse' + +using System.Collections.Generic; +using Test; + +namespace Test +{ + public class ListKnownNeuronsResponse + { + public List known_neurons { get; set; } + + public ListKnownNeuronsResponse(List knownNeurons) + { + this.known_neurons = knownNeurons; + } + + public ListKnownNeuronsResponse() + { + } + } +} + +Type File: 'ListNeurons' + +using System.Collections.Generic; + +namespace Test +{ + public class ListNeurons + { + public List neuron_ids { get; set; } + + public bool include_neurons_readable_by_caller { get; set; } + + public ListNeurons(List neuronIds, bool includeNeuronsReadableByCaller) + { + this.neuron_ids = neuronIds; + this.include_neurons_readable_by_caller = includeNeuronsReadableByCaller; + } + + public ListNeurons() + { + } + } +} + +Type File: 'ListNeuronsResponse' + +using System.Collections.Generic; +using Test; + +namespace Test +{ + public class ListNeuronsResponse + { + public Dictionary neuron_infos { get; set; } + + public List full_neurons { get; set; } + + public ListNeuronsResponse(Dictionary neuronInfos, List fullNeurons) + { + this.neuron_infos = neuronInfos; + this.full_neurons = fullNeurons; + } + + public ListNeuronsResponse() + { + } + } +} + +Type File: 'ListNodeProvidersResponse' + +using System.Collections.Generic; +using Test; + +namespace Test +{ + public class ListNodeProvidersResponse + { + public List node_providers { get; set; } + + public ListNodeProvidersResponse(List nodeProviders) + { + this.node_providers = nodeProviders; + } + + public ListNodeProvidersResponse() + { + } + } +} + +Type File: 'ListProposalInfo' + +using System.Collections.Generic; +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class ListProposalInfo + { + public List include_reward_status { get; set; } + + public OptionalValue before_proposal { get; set; } + + public uint limit { get; set; } + + public List exclude_topic { get; set; } + + public List include_status { get; set; } + + public ListProposalInfo(List includeRewardStatus, OptionalValue beforeProposal, uint limit, List excludeTopic, List includeStatus) + { + this.include_reward_status = includeRewardStatus; + this.before_proposal = beforeProposal; + this.limit = limit; + this.exclude_topic = excludeTopic; + this.include_status = includeStatus; + } + + public ListProposalInfo() + { + } + } +} + +Type File: 'ListProposalInfoResponse' + +using System.Collections.Generic; +using Test; + +namespace Test +{ + public class ListProposalInfoResponse + { + public List proposal_info { get; set; } + + public ListProposalInfoResponse(List proposalInfo) + { + this.proposal_info = proposalInfo; + } + + public ListProposalInfoResponse() + { + } + } +} + +Type File: 'MakeProposalResponse' + +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class MakeProposalResponse + { + public OptionalValue proposal_id { get; set; } + + public MakeProposalResponse(OptionalValue proposalId) + { + this.proposal_id = proposalId; + } + + public MakeProposalResponse() + { + } + } +} + +Type File: 'ManageNeuron' + +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class ManageNeuron + { + public OptionalValue id { get; set; } + + public OptionalValue command { get; set; } + + public OptionalValue neuron_id_or_subaccount { get; set; } + + public ManageNeuron(OptionalValue id, OptionalValue command, OptionalValue neuronIdOrSubaccount) + { + this.id = id; + this.command = command; + this.neuron_id_or_subaccount = neuronIdOrSubaccount; + } + + public ManageNeuron() + { + } + } +} + +Type File: 'ManageNeuronResponse' + +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class ManageNeuronResponse + { + public OptionalValue command { get; set; } + + public ManageNeuronResponse(OptionalValue command) + { + this.command = command; + } + + public ManageNeuronResponse() + { + } + } +} + +Type File: 'Merge' + +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class Merge + { + public OptionalValue source_neuron_id { get; set; } + + public Merge(OptionalValue sourceNeuronId) + { + this.source_neuron_id = sourceNeuronId; + } + + public Merge() + { + } + } +} + +Type File: 'MergeMaturity' + +namespace Test +{ + public class MergeMaturity + { + public uint percentage_to_merge { get; set; } + + public MergeMaturity(uint percentageToMerge) + { + this.percentage_to_merge = percentageToMerge; + } + + public MergeMaturity() + { + } + } +} + +Type File: 'MergeMaturityResponse' + +namespace Test +{ + public class MergeMaturityResponse + { + public ulong merged_maturity_e8s { get; set; } + + public ulong new_stake_e8s { get; set; } + + public MergeMaturityResponse(ulong mergedMaturityE8s, ulong newStakeE8s) + { + this.merged_maturity_e8s = mergedMaturityE8s; + this.new_stake_e8s = newStakeE8s; + } + + public MergeMaturityResponse() + { + } + } +} + +Type File: 'Motion' + +namespace Test +{ + public class Motion + { + public string motion_text { get; set; } + + public Motion(string motionText) + { + this.motion_text = motionText; + } + + public Motion() + { + } + } +} + +Type File: 'NetworkEconomics' + +namespace Test +{ + public class NetworkEconomics + { + public ulong neuron_minimum_stake_e8s { get; set; } + + public uint max_proposals_to_keep_per_topic { get; set; } + + public ulong neuron_management_fee_per_proposal_e8s { get; set; } + + public ulong reject_cost_e8s { get; set; } + + public ulong transaction_fee_e8s { get; set; } + + public ulong neuron_spawn_dissolve_delay_seconds { get; set; } + + public ulong minimum_icp_xdr_rate { get; set; } + + public ulong maximum_node_provider_rewards_e8s { get; set; } + + public NetworkEconomics(ulong neuronMinimumStakeE8s, uint maxProposalsToKeepPerTopic, ulong neuronManagementFeePerProposalE8s, ulong rejectCostE8s, ulong transactionFeeE8s, ulong neuronSpawnDissolveDelaySeconds, ulong minimumIcpXdrRate, ulong maximumNodeProviderRewardsE8s) + { + this.neuron_minimum_stake_e8s = neuronMinimumStakeE8s; + this.max_proposals_to_keep_per_topic = maxProposalsToKeepPerTopic; + this.neuron_management_fee_per_proposal_e8s = neuronManagementFeePerProposalE8s; + this.reject_cost_e8s = rejectCostE8s; + this.transaction_fee_e8s = transactionFeeE8s; + this.neuron_spawn_dissolve_delay_seconds = neuronSpawnDissolveDelaySeconds; + this.minimum_icp_xdr_rate = minimumIcpXdrRate; + this.maximum_node_provider_rewards_e8s = maximumNodeProviderRewardsE8s; + } + + public NetworkEconomics() + { + } + } +} + +Type File: 'Neuron' + +using EdjCase.ICP.Candid.Models; +using Test; +using System.Collections.Generic; + +namespace Test +{ + public class Neuron + { + public OptionalValue id { get; set; } + + public OptionalValue controller { get; set; } + + public List recent_ballots { get; set; } + + public bool kyc_verified { get; set; } + + public bool not_for_profit { get; set; } + + public ulong maturity_e8s_equivalent { get; set; } + + public ulong cached_neuron_stake_e8s { get; set; } + + public ulong created_timestamp_seconds { get; set; } + + public ulong aging_since_timestamp_seconds { get; set; } + + public List hot_keys { get; set; } + + public List account { get; set; } + + public OptionalValue joined_community_fund_timestamp_seconds { get; set; } + + public OptionalValue dissolve_state { get; set; } + + public Dictionary followees { get; set; } + + public ulong neuron_fees_e8s { get; set; } + + public OptionalValue transfer { get; set; } + + public OptionalValue known_neuron_data { get; set; } + + public Neuron(OptionalValue id, OptionalValue controller, List recentBallots, bool kycVerified, bool notForProfit, ulong maturityE8sEquivalent, ulong cachedNeuronStakeE8s, ulong createdTimestampSeconds, ulong agingSinceTimestampSeconds, List hotKeys, List account, OptionalValue joinedCommunityFundTimestampSeconds, OptionalValue dissolveState, Dictionary followees, ulong neuronFeesE8s, OptionalValue transfer, OptionalValue knownNeuronData) + { + this.id = id; + this.controller = controller; + this.recent_ballots = recentBallots; + this.kyc_verified = kycVerified; + this.not_for_profit = notForProfit; + this.maturity_e8s_equivalent = maturityE8sEquivalent; + this.cached_neuron_stake_e8s = cachedNeuronStakeE8s; + this.created_timestamp_seconds = createdTimestampSeconds; + this.aging_since_timestamp_seconds = agingSinceTimestampSeconds; + this.hot_keys = hotKeys; + this.account = account; + this.joined_community_fund_timestamp_seconds = joinedCommunityFundTimestampSeconds; + this.dissolve_state = dissolveState; + this.followees = followees; + this.neuron_fees_e8s = neuronFeesE8s; + this.transfer = transfer; + this.known_neuron_data = knownNeuronData; + } + + public Neuron() + { + } + } +} + +Type File: 'NeuronId' + +namespace Test +{ + public class NeuronId + { + public ulong id { get; set; } + + public NeuronId(ulong id) + { + this.id = id; + } + + public NeuronId() + { + } + } +} + +Type File: 'NeuronIdOrSubaccount' + +using EdjCase.ICP.Candid.Mapping; +using Test; +using System.Collections.Generic; + +namespace Test +{ + [Variant()] + public class NeuronIdOrSubaccount + { + [VariantTagProperty()] + public NeuronIdOrSubaccountTag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public List Subaccount { get => this.Tag == NeuronIdOrSubaccountTag.Subaccount ? (List)this.Value! : default; set => (this.Tag, this.Value) = (NeuronIdOrSubaccountTag.Subaccount, value); } + + public NeuronId NeuronId { get => this.Tag == NeuronIdOrSubaccountTag.NeuronId ? (NeuronId)this.Value! : default; set => (this.Tag, this.Value) = (NeuronIdOrSubaccountTag.NeuronId, value); } + + public NeuronIdOrSubaccount(NeuronIdOrSubaccountTag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected NeuronIdOrSubaccount() + { + } + } + + public enum NeuronIdOrSubaccountTag + { + Subaccount, + NeuronId + } +} + +Type File: 'NeuronInFlightCommand' + +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class NeuronInFlightCommand + { + public OptionalValue command { get; set; } + + public ulong timestamp { get; set; } + + public NeuronInFlightCommand(OptionalValue command, ulong timestamp) + { + this.command = command; + this.timestamp = timestamp; + } + + public NeuronInFlightCommand() + { + } + } +} + +Type File: 'NeuronInfo' + +using System.Collections.Generic; +using Test; +using EdjCase.ICP.Candid.Models; + +namespace Test +{ + public class NeuronInfo + { + public ulong dissolve_delay_seconds { get; set; } + + public List recent_ballots { get; set; } + + public ulong created_timestamp_seconds { get; set; } + + public int state { get; set; } + + public ulong stake_e8s { get; set; } + + public OptionalValue joined_community_fund_timestamp_seconds { get; set; } + + public ulong retrieved_at_timestamp_seconds { get; set; } + + public OptionalValue known_neuron_data { get; set; } + + public ulong voting_power { get; set; } + + public ulong age_seconds { get; set; } + + public NeuronInfo(ulong dissolveDelaySeconds, List recentBallots, ulong createdTimestampSeconds, int state, ulong stakeE8s, OptionalValue joinedCommunityFundTimestampSeconds, ulong retrievedAtTimestampSeconds, OptionalValue knownNeuronData, ulong votingPower, ulong ageSeconds) + { + this.dissolve_delay_seconds = dissolveDelaySeconds; + this.recent_ballots = recentBallots; + this.created_timestamp_seconds = createdTimestampSeconds; + this.state = state; + this.stake_e8s = stakeE8s; + this.joined_community_fund_timestamp_seconds = joinedCommunityFundTimestampSeconds; + this.retrieved_at_timestamp_seconds = retrievedAtTimestampSeconds; + this.known_neuron_data = knownNeuronData; + this.voting_power = votingPower; + this.age_seconds = ageSeconds; + } + + public NeuronInfo() + { + } + } +} + +Type File: 'NeuronStakeTransfer' + +using System.Collections.Generic; +using EdjCase.ICP.Candid.Models; + +namespace Test +{ + public class NeuronStakeTransfer + { + public List to_subaccount { get; set; } + + public ulong neuron_stake_e8s { get; set; } + + public OptionalValue from { get; set; } + + public ulong memo { get; set; } + + public List from_subaccount { get; set; } + + public ulong transfer_timestamp { get; set; } + + public ulong block_height { get; set; } + + public NeuronStakeTransfer(List toSubaccount, ulong neuronStakeE8s, OptionalValue from, ulong memo, List fromSubaccount, ulong transferTimestamp, ulong blockHeight) + { + this.to_subaccount = toSubaccount; + this.neuron_stake_e8s = neuronStakeE8s; + this.from = from; + this.memo = memo; + this.from_subaccount = fromSubaccount; + this.transfer_timestamp = transferTimestamp; + this.block_height = blockHeight; + } + + public NeuronStakeTransfer() + { + } + } +} + +Type File: 'NodeProvider' + +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class NodeProvider + { + public OptionalValue id { get; set; } + + public OptionalValue reward_account { get; set; } + + public NodeProvider(OptionalValue id, OptionalValue rewardAccount) + { + this.id = id; + this.reward_account = rewardAccount; + } + + public NodeProvider() + { + } + } +} + +Type File: 'Operation' + +using EdjCase.ICP.Candid.Mapping; +using Test; + +namespace Test +{ + [Variant()] + public class Operation + { + [VariantTagProperty()] + public OperationTag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public RemoveHotKey RemoveHotKey { get => this.Tag == OperationTag.RemoveHotKey ? (RemoveHotKey)this.Value! : default; set => (this.Tag, this.Value) = (OperationTag.RemoveHotKey, value); } + + public AddHotKey AddHotKey { get => this.Tag == OperationTag.AddHotKey ? (AddHotKey)this.Value! : default; set => (this.Tag, this.Value) = (OperationTag.AddHotKey, value); } + + public Operation.StopDissolvingInfo StopDissolving { get => this.Tag == OperationTag.StopDissolving ? (Operation.StopDissolvingInfo)this.Value! : default; set => (this.Tag, this.Value) = (OperationTag.StopDissolving, value); } + + public Operation.StartDissolvingInfo StartDissolving { get => this.Tag == OperationTag.StartDissolving ? (Operation.StartDissolvingInfo)this.Value! : default; set => (this.Tag, this.Value) = (OperationTag.StartDissolving, value); } + + public IncreaseDissolveDelay IncreaseDissolveDelay { get => this.Tag == OperationTag.IncreaseDissolveDelay ? (IncreaseDissolveDelay)this.Value! : default; set => (this.Tag, this.Value) = (OperationTag.IncreaseDissolveDelay, value); } + + public Operation.JoinCommunityFundInfo JoinCommunityFund { get => this.Tag == OperationTag.JoinCommunityFund ? (Operation.JoinCommunityFundInfo)this.Value! : default; set => (this.Tag, this.Value) = (OperationTag.JoinCommunityFund, value); } + + public SetDissolveTimestamp SetDissolveTimestamp { get => this.Tag == OperationTag.SetDissolveTimestamp ? (SetDissolveTimestamp)this.Value! : default; set => (this.Tag, this.Value) = (OperationTag.SetDissolveTimestamp, value); } + + public Operation(OperationTag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected Operation() + { + } + + public class StopDissolvingInfo + { + public StopDissolvingInfo() + { + } + } + + public class StartDissolvingInfo + { + public StartDissolvingInfo() + { + } + } + + public class JoinCommunityFundInfo + { + public JoinCommunityFundInfo() + { + } + } + } + + public enum OperationTag + { + RemoveHotKey, + AddHotKey, + StopDissolving, + StartDissolving, + IncreaseDissolveDelay, + JoinCommunityFund, + SetDissolveTimestamp + } +} + +Type File: 'Proposal' + +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class Proposal + { + public string url { get; set; } + + public OptionalValue title { get; set; } + + public OptionalValue action { get; set; } + + public string summary { get; set; } + + public Proposal(string url, OptionalValue title, OptionalValue action, string summary) + { + this.url = url; + this.title = title; + this.action = action; + this.summary = summary; + } + + public Proposal() + { + } + } +} + +Type File: 'ProposalData' + +using EdjCase.ICP.Candid.Models; +using Test; +using System.Collections.Generic; + +namespace Test +{ + public class ProposalData + { + public OptionalValue id { get; set; } + + public OptionalValue failure_reason { get; set; } + + public Dictionary ballots { get; set; } + + public ulong proposal_timestamp_seconds { get; set; } + + public ulong reward_event_round { get; set; } + + public ulong failed_timestamp_seconds { get; set; } + + public ulong reject_cost_e8s { get; set; } + + public OptionalValue latest_tally { get; set; } + + public ulong decided_timestamp_seconds { get; set; } + + public OptionalValue proposal { get; set; } + + public OptionalValue proposer { get; set; } + + public OptionalValue wait_for_quiet_state { get; set; } + + public ulong executed_timestamp_seconds { get; set; } + + public ProposalData(OptionalValue id, OptionalValue failureReason, Dictionary ballots, ulong proposalTimestampSeconds, ulong rewardEventRound, ulong failedTimestampSeconds, ulong rejectCostE8s, OptionalValue latestTally, ulong decidedTimestampSeconds, OptionalValue proposal, OptionalValue proposer, OptionalValue waitForQuietState, ulong executedTimestampSeconds) + { + this.id = id; + this.failure_reason = failureReason; + this.ballots = ballots; + this.proposal_timestamp_seconds = proposalTimestampSeconds; + this.reward_event_round = rewardEventRound; + this.failed_timestamp_seconds = failedTimestampSeconds; + this.reject_cost_e8s = rejectCostE8s; + this.latest_tally = latestTally; + this.decided_timestamp_seconds = decidedTimestampSeconds; + this.proposal = proposal; + this.proposer = proposer; + this.wait_for_quiet_state = waitForQuietState; + this.executed_timestamp_seconds = executedTimestampSeconds; + } + + public ProposalData() + { + } + } +} + +Type File: 'ProposalInfo' + +using EdjCase.ICP.Candid.Models; +using Test; +using System.Collections.Generic; + +namespace Test +{ + public class ProposalInfo + { + public OptionalValue id { get; set; } + + public int status { get; set; } + + public int topic { get; set; } + + public OptionalValue failure_reason { get; set; } + + public Dictionary ballots { get; set; } + + public ulong proposal_timestamp_seconds { get; set; } + + public ulong reward_event_round { get; set; } + + public OptionalValue deadline_timestamp_seconds { get; set; } + + public ulong failed_timestamp_seconds { get; set; } + + public ulong reject_cost_e8s { get; set; } + + public OptionalValue latest_tally { get; set; } + + public int reward_status { get; set; } + + public ulong decided_timestamp_seconds { get; set; } + + public OptionalValue proposal { get; set; } + + public OptionalValue proposer { get; set; } + + public ulong executed_timestamp_seconds { get; set; } + + public ProposalInfo(OptionalValue id, int status, int topic, OptionalValue failureReason, Dictionary ballots, ulong proposalTimestampSeconds, ulong rewardEventRound, OptionalValue deadlineTimestampSeconds, ulong failedTimestampSeconds, ulong rejectCostE8s, OptionalValue latestTally, int rewardStatus, ulong decidedTimestampSeconds, OptionalValue proposal, OptionalValue proposer, ulong executedTimestampSeconds) + { + this.id = id; + this.status = status; + this.topic = topic; + this.failure_reason = failureReason; + this.ballots = ballots; + this.proposal_timestamp_seconds = proposalTimestampSeconds; + this.reward_event_round = rewardEventRound; + this.deadline_timestamp_seconds = deadlineTimestampSeconds; + this.failed_timestamp_seconds = failedTimestampSeconds; + this.reject_cost_e8s = rejectCostE8s; + this.latest_tally = latestTally; + this.reward_status = rewardStatus; + this.decided_timestamp_seconds = decidedTimestampSeconds; + this.proposal = proposal; + this.proposer = proposer; + this.executed_timestamp_seconds = executedTimestampSeconds; + } + + public ProposalInfo() + { + } + } +} + +Type File: 'RegisterVote' + +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class RegisterVote + { + public int vote { get; set; } + + public OptionalValue proposal { get; set; } + + public RegisterVote(int vote, OptionalValue proposal) + { + this.vote = vote; + this.proposal = proposal; + } + + public RegisterVote() + { + } + } +} + +Type File: 'RemoveHotKey' + +using EdjCase.ICP.Candid.Models; + +namespace Test +{ + public class RemoveHotKey + { + public OptionalValue hot_key_to_remove { get; set; } + + public RemoveHotKey(OptionalValue hotKeyToRemove) + { + this.hot_key_to_remove = hotKeyToRemove; + } + + public RemoveHotKey() + { + } + } +} + +Type File: 'Result' + +using EdjCase.ICP.Candid.Mapping; +using Test; + +namespace Test +{ + [Variant()] + public class Result + { + [VariantTagProperty()] + public ResultTag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public GovernanceError Err { get => this.Tag == ResultTag.Err ? (GovernanceError)this.Value! : default; set => (this.Tag, this.Value) = (ResultTag.Err, value); } + + public Result(ResultTag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected Result() + { + } + } + + public enum ResultTag + { + Ok, + Err + } +} + +Type File: 'Result_1' + +using EdjCase.ICP.Candid.Mapping; +using Test; + +namespace Test +{ + [Variant()] + public class Result_1 + { + [VariantTagProperty()] + public Result_1Tag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public GovernanceError Error { get => this.Tag == Result_1Tag.Error ? (GovernanceError)this.Value! : default; set => (this.Tag, this.Value) = (Result_1Tag.Error, value); } + + public NeuronId NeuronId { get => this.Tag == Result_1Tag.NeuronId ? (NeuronId)this.Value! : default; set => (this.Tag, this.Value) = (Result_1Tag.NeuronId, value); } + + public Result_1(Result_1Tag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected Result_1() + { + } + } + + public enum Result_1Tag + { + Error, + NeuronId + } +} + +Type File: 'Result_2' + +using EdjCase.ICP.Candid.Mapping; +using Test; + +namespace Test +{ + [Variant()] + public class Result_2 + { + [VariantTagProperty()] + public Result_2Tag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public Neuron Ok { get => this.Tag == Result_2Tag.Ok ? (Neuron)this.Value! : default; set => (this.Tag, this.Value) = (Result_2Tag.Ok, value); } + + public GovernanceError Err { get => this.Tag == Result_2Tag.Err ? (GovernanceError)this.Value! : default; set => (this.Tag, this.Value) = (Result_2Tag.Err, value); } + + public Result_2(Result_2Tag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected Result_2() + { + } + } + + public enum Result_2Tag + { + Ok, + Err + } +} + +Type File: 'Result_3' + +using EdjCase.ICP.Candid.Mapping; +using Test; + +namespace Test +{ + [Variant()] + public class Result_3 + { + [VariantTagProperty()] + public Result_3Tag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public RewardNodeProviders Ok { get => this.Tag == Result_3Tag.Ok ? (RewardNodeProviders)this.Value! : default; set => (this.Tag, this.Value) = (Result_3Tag.Ok, value); } + + public GovernanceError Err { get => this.Tag == Result_3Tag.Err ? (GovernanceError)this.Value! : default; set => (this.Tag, this.Value) = (Result_3Tag.Err, value); } + + public Result_3(Result_3Tag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected Result_3() + { + } + } + + public enum Result_3Tag + { + Ok, + Err + } +} + +Type File: 'Result_4' + +using EdjCase.ICP.Candid.Mapping; +using Test; + +namespace Test +{ + [Variant()] + public class Result_4 + { + [VariantTagProperty()] + public Result_4Tag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public NeuronInfo Ok { get => this.Tag == Result_4Tag.Ok ? (NeuronInfo)this.Value! : default; set => (this.Tag, this.Value) = (Result_4Tag.Ok, value); } + + public GovernanceError Err { get => this.Tag == Result_4Tag.Err ? (GovernanceError)this.Value! : default; set => (this.Tag, this.Value) = (Result_4Tag.Err, value); } + + public Result_4(Result_4Tag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected Result_4() + { + } + } + + public enum Result_4Tag + { + Ok, + Err + } +} + +Type File: 'Result_5' + +using EdjCase.ICP.Candid.Mapping; +using Test; + +namespace Test +{ + [Variant()] + public class Result_5 + { + [VariantTagProperty()] + public Result_5Tag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public NodeProvider Ok { get => this.Tag == Result_5Tag.Ok ? (NodeProvider)this.Value! : default; set => (this.Tag, this.Value) = (Result_5Tag.Ok, value); } + + public GovernanceError Err { get => this.Tag == Result_5Tag.Err ? (GovernanceError)this.Value! : default; set => (this.Tag, this.Value) = (Result_5Tag.Err, value); } + + public Result_5(Result_5Tag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected Result_5() + { + } + } + + public enum Result_5Tag + { + Ok, + Err + } +} + +Type File: 'RewardEvent' + +using System.Collections.Generic; +using Test; + +namespace Test +{ + public class RewardEvent + { + public ulong day_after_genesis { get; set; } + + public ulong actual_timestamp_seconds { get; set; } + + public ulong distributed_e8s_equivalent { get; set; } + + public List settled_proposals { get; set; } + + public RewardEvent(ulong dayAfterGenesis, ulong actualTimestampSeconds, ulong distributedE8sEquivalent, List settledProposals) + { + this.day_after_genesis = dayAfterGenesis; + this.actual_timestamp_seconds = actualTimestampSeconds; + this.distributed_e8s_equivalent = distributedE8sEquivalent; + this.settled_proposals = settledProposals; + } + + public RewardEvent() + { + } + } +} + +Type File: 'RewardMode' + +using EdjCase.ICP.Candid.Mapping; +using Test; + +namespace Test +{ + [Variant()] + public class RewardMode + { + [VariantTagProperty()] + public RewardModeTag Tag { get; set; } + + [VariantValueProperty()] + public object Value { get; set; } + + public RewardToNeuron RewardToNeuron { get => this.Tag == RewardModeTag.RewardToNeuron ? (RewardToNeuron)this.Value! : default; set => (this.Tag, this.Value) = (RewardModeTag.RewardToNeuron, value); } + + public RewardToAccount RewardToAccount { get => this.Tag == RewardModeTag.RewardToAccount ? (RewardToAccount)this.Value! : default; set => (this.Tag, this.Value) = (RewardModeTag.RewardToAccount, value); } + + public RewardMode(RewardModeTag tag, object value) + { + this.Tag = tag; + this.Value = value; + } + + protected RewardMode() + { + } + } + + public enum RewardModeTag + { + RewardToNeuron, + RewardToAccount + } +} + +Type File: 'RewardNodeProvider' + +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class RewardNodeProvider + { + public OptionalValue node_provider { get; set; } + + public OptionalValue reward_mode { get; set; } + + public ulong amount_e8s { get; set; } + + public RewardNodeProvider(OptionalValue nodeProvider, OptionalValue rewardMode, ulong amountE8s) + { + this.node_provider = nodeProvider; + this.reward_mode = rewardMode; + this.amount_e8s = amountE8s; + } + + public RewardNodeProvider() + { + } + } +} + +Type File: 'RewardNodeProviders' + +using EdjCase.ICP.Candid.Models; +using System.Collections.Generic; +using Test; + +namespace Test +{ + public class RewardNodeProviders + { + public OptionalValue use_registry_derived_rewards { get; set; } + + public List rewards { get; set; } + + public RewardNodeProviders(OptionalValue useRegistryDerivedRewards, List rewards) + { + this.use_registry_derived_rewards = useRegistryDerivedRewards; + this.rewards = rewards; + } + + public RewardNodeProviders() + { + } + } +} + +Type File: 'RewardToAccount' + +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class RewardToAccount + { + public OptionalValue to_account { get; set; } + + public RewardToAccount(OptionalValue toAccount) + { + this.to_account = toAccount; + } + + public RewardToAccount() + { + } + } +} + +Type File: 'RewardToNeuron' + +namespace Test +{ + public class RewardToNeuron + { + public ulong dissolve_delay_seconds { get; set; } + + public RewardToNeuron(ulong dissolveDelaySeconds) + { + this.dissolve_delay_seconds = dissolveDelaySeconds; + } + + public RewardToNeuron() + { + } + } +} + +Type File: 'SetDefaultFollowees' + +using System.Collections.Generic; +using Test; + +namespace Test +{ + public class SetDefaultFollowees + { + public Dictionary default_followees { get; set; } + + public SetDefaultFollowees(Dictionary defaultFollowees) + { + this.default_followees = defaultFollowees; + } + + public SetDefaultFollowees() + { + } + } +} + +Type File: 'SetDissolveTimestamp' + +namespace Test +{ + public class SetDissolveTimestamp + { + public ulong dissolve_timestamp_seconds { get; set; } + + public SetDissolveTimestamp(ulong dissolveTimestampSeconds) + { + this.dissolve_timestamp_seconds = dissolveTimestampSeconds; + } + + public SetDissolveTimestamp() + { + } + } +} + +Type File: 'Spawn' + +using EdjCase.ICP.Candid.Models; + +namespace Test +{ + public class Spawn + { + public OptionalValue percentage_to_spawn { get; set; } + + public OptionalValue new_controller { get; set; } + + public OptionalValue nonce { get; set; } + + public Spawn(OptionalValue percentageToSpawn, OptionalValue newController, OptionalValue nonce) + { + this.percentage_to_spawn = percentageToSpawn; + this.new_controller = newController; + this.nonce = nonce; + } + + public Spawn() + { + } + } +} + +Type File: 'SpawnResponse' + +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class SpawnResponse + { + public OptionalValue created_neuron_id { get; set; } + + public SpawnResponse(OptionalValue createdNeuronId) + { + this.created_neuron_id = createdNeuronId; + } + + public SpawnResponse() + { + } + } +} + +Type File: 'Split' + +namespace Test +{ + public class Split + { + public ulong amount_e8s { get; set; } + + public Split(ulong amountE8s) + { + this.amount_e8s = amountE8s; + } + + public Split() + { + } + } +} + +Type File: 'Tally' + +namespace Test +{ + public class Tally + { + public ulong no { get; set; } + + public ulong yes { get; set; } + + public ulong total { get; set; } + + public ulong timestamp_seconds { get; set; } + + public Tally(ulong no, ulong yes, ulong total, ulong timestampSeconds) + { + this.no = no; + this.yes = yes; + this.total = total; + this.timestamp_seconds = timestampSeconds; + } + + public Tally() + { + } + } +} + +Type File: 'UpdateNodeProvider' + +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class UpdateNodeProvider + { + public OptionalValue reward_account { get; set; } + + public UpdateNodeProvider(OptionalValue rewardAccount) + { + this.reward_account = rewardAccount; + } + + public UpdateNodeProvider() + { + } + } +} + +Type File: 'WaitForQuietState' + +namespace Test +{ + public class WaitForQuietState + { + public ulong current_deadline_timestamp_seconds { get; set; } + + public WaitForQuietState(ulong currentDeadlineTimestampSeconds) + { + this.current_deadline_timestamp_seconds = currentDeadlineTimestampSeconds; + } + + public WaitForQuietState() + { + } + } +} diff --git a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_True_KeepCandidCase_False.snap b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False.snap similarity index 95% rename from test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_True_KeepCandidCase_False.snap rename to test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False.snap index db622c42..f9968368 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_True_KeepCandidCase_False.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_False.snap @@ -210,7 +210,7 @@ using System; namespace Test { - [Variant(typeof(ActionTag))] + [Variant()] public class Action { [VariantTagProperty()] @@ -350,25 +350,15 @@ namespace Test public enum ActionTag { - [VariantOptionType(typeof(KnownNeuron))] RegisterKnownNeuron, - [VariantOptionType(typeof(ManageNeuron))] ManageNeuron, - [VariantOptionType(typeof(ExecuteNnsFunction))] ExecuteNnsFunction, - [VariantOptionType(typeof(RewardNodeProvider))] RewardNodeProvider, - [VariantOptionType(typeof(SetDefaultFollowees))] SetDefaultFollowees, - [VariantOptionType(typeof(RewardNodeProviders))] RewardNodeProviders, - [VariantOptionType(typeof(NetworkEconomics))] ManageNetworkEconomics, - [VariantOptionType(typeof(ApproveGenesisKyc))] ApproveGenesisKyc, - [VariantOptionType(typeof(AddOrRemoveNodeProvider))] AddOrRemoveNodeProvider, - [VariantOptionType(typeof(Motion))] Motion } } @@ -528,7 +518,7 @@ using System; namespace Test { - [Variant(typeof(ByTag))] + [Variant()] public class By { [VariantTagProperty()] @@ -598,11 +588,8 @@ namespace Test public enum ByTag { - [VariantOptionType(typeof(By.NeuronIdOrSubaccountInfo))] NeuronIdOrSubaccount, - [VariantOptionType(typeof(ClaimOrRefreshNeuronFromAccount))] MemoAndController, - [VariantOptionType(typeof(ulong))] Memo } } @@ -615,7 +602,7 @@ using System; namespace Test { - [Variant(typeof(ChangeTag))] + [Variant()] public class Change { [VariantTagProperty()] @@ -667,9 +654,7 @@ namespace Test public enum ChangeTag { - [VariantOptionType(typeof(NodeProvider))] ToRemove, - [VariantOptionType(typeof(NodeProvider))] ToAdd } } @@ -781,7 +766,7 @@ using System; namespace Test { - [Variant(typeof(CommandTag))] + [Variant()] public class Command { [VariantTagProperty()] @@ -932,27 +917,16 @@ namespace Test public enum CommandTag { - [VariantOptionType(typeof(Spawn))] Spawn, - [VariantOptionType(typeof(Split))] Split, - [VariantOptionType(typeof(Follow))] Follow, - [VariantOptionType(typeof(ClaimOrRefresh))] ClaimOrRefresh, - [VariantOptionType(typeof(Configure))] Configure, - [VariantOptionType(typeof(RegisterVote))] RegisterVote, - [VariantOptionType(typeof(Merge))] Merge, - [VariantOptionType(typeof(DisburseToNeuron))] DisburseToNeuron, - [VariantOptionType(typeof(Proposal))] MakeProposal, - [VariantOptionType(typeof(MergeMaturity))] MergeMaturity, - [VariantOptionType(typeof(Disburse))] Disburse } } @@ -965,7 +939,7 @@ using System; namespace Test { - [Variant(typeof(Command1Tag))] + [Variant()] public class Command1 { [VariantTagProperty()] @@ -1155,29 +1129,17 @@ namespace Test public enum Command1Tag { - [VariantOptionType(typeof(GovernanceError))] Error, - [VariantOptionType(typeof(SpawnResponse))] Spawn, - [VariantOptionType(typeof(SpawnResponse))] Split, - [VariantOptionType(typeof(Command1.FollowInfo))] Follow, - [VariantOptionType(typeof(ClaimOrRefreshResponse))] ClaimOrRefresh, - [VariantOptionType(typeof(Command1.ConfigureInfo))] Configure, - [VariantOptionType(typeof(Command1.RegisterVoteInfo))] RegisterVote, - [VariantOptionType(typeof(Command1.MergeInfo))] Merge, - [VariantOptionType(typeof(SpawnResponse))] DisburseToNeuron, - [VariantOptionType(typeof(MakeProposalResponse))] MakeProposal, - [VariantOptionType(typeof(MergeMaturityResponse))] MergeMaturity, - [VariantOptionType(typeof(DisburseResponse))] Disburse } } @@ -1190,7 +1152,7 @@ using System; namespace Test { - [Variant(typeof(Command2Tag))] + [Variant()] public class Command2 { [VariantTagProperty()] @@ -1308,21 +1270,13 @@ namespace Test public enum Command2Tag { - [VariantOptionType(typeof(Spawn))] Spawn, - [VariantOptionType(typeof(Split))] Split, - [VariantOptionType(typeof(Configure))] Configure, - [VariantOptionType(typeof(Merge))] Merge, - [VariantOptionType(typeof(DisburseToNeuron))] DisburseToNeuron, - [VariantOptionType(typeof(ClaimOrRefresh))] ClaimOrRefreshNeuron, - [VariantOptionType(typeof(MergeMaturity))] MergeMaturity, - [VariantOptionType(typeof(Disburse))] Disburse } } @@ -1448,7 +1402,7 @@ using System; namespace Test { - [Variant(typeof(DissolveStateTag))] + [Variant()] public class DissolveState { [VariantTagProperty()] @@ -1500,9 +1454,7 @@ namespace Test public enum DissolveStateTag { - [VariantOptionType(typeof(ulong))] DissolveDelaySeconds, - [VariantOptionType(typeof(ulong))] WhenDissolvedTimestampSeconds } } @@ -2353,7 +2305,7 @@ using System; namespace Test { - [Variant(typeof(NeuronIdOrSubaccountTag))] + [Variant()] public class NeuronIdOrSubaccount { [VariantTagProperty()] @@ -2405,9 +2357,7 @@ namespace Test public enum NeuronIdOrSubaccountTag { - [VariantOptionType(typeof(List))] Subaccount, - [VariantOptionType(typeof(NeuronId))] NeuronId } } @@ -2585,7 +2535,7 @@ using System; namespace Test { - [Variant(typeof(OperationTag))] + [Variant()] public class Operation { [VariantTagProperty()] @@ -2713,19 +2663,12 @@ namespace Test public enum OperationTag { - [VariantOptionType(typeof(RemoveHotKey))] RemoveHotKey, - [VariantOptionType(typeof(AddHotKey))] AddHotKey, - [VariantOptionType(typeof(Operation.StopDissolvingInfo))] StopDissolving, - [VariantOptionType(typeof(Operation.StartDissolvingInfo))] StartDissolving, - [VariantOptionType(typeof(IncreaseDissolveDelay))] IncreaseDissolveDelay, - [VariantOptionType(typeof(Operation.JoinCommunityFundInfo))] JoinCommunityFund, - [VariantOptionType(typeof(SetDissolveTimestamp))] SetDissolveTimestamp } } @@ -2983,7 +2926,7 @@ using System; namespace Test { - [Variant(typeof(ResultTag))] + [Variant()] public class Result { [VariantTagProperty()] @@ -3030,7 +2973,6 @@ namespace Test public enum ResultTag { Ok, - [VariantOptionType(typeof(GovernanceError))] Err } } @@ -3043,7 +2985,7 @@ using System; namespace Test { - [Variant(typeof(Result1Tag))] + [Variant()] public class Result1 { [VariantTagProperty()] @@ -3095,9 +3037,7 @@ namespace Test public enum Result1Tag { - [VariantOptionType(typeof(GovernanceError))] Error, - [VariantOptionType(typeof(NeuronId))] NeuronId } } @@ -3110,7 +3050,7 @@ using System; namespace Test { - [Variant(typeof(Result2Tag))] + [Variant()] public class Result2 { [VariantTagProperty()] @@ -3162,9 +3102,7 @@ namespace Test public enum Result2Tag { - [VariantOptionType(typeof(Neuron))] Ok, - [VariantOptionType(typeof(GovernanceError))] Err } } @@ -3177,7 +3115,7 @@ using System; namespace Test { - [Variant(typeof(Result3Tag))] + [Variant()] public class Result3 { [VariantTagProperty()] @@ -3229,9 +3167,7 @@ namespace Test public enum Result3Tag { - [VariantOptionType(typeof(RewardNodeProviders))] Ok, - [VariantOptionType(typeof(GovernanceError))] Err } } @@ -3244,7 +3180,7 @@ using System; namespace Test { - [Variant(typeof(Result4Tag))] + [Variant()] public class Result4 { [VariantTagProperty()] @@ -3296,9 +3232,7 @@ namespace Test public enum Result4Tag { - [VariantOptionType(typeof(NeuronInfo))] Ok, - [VariantOptionType(typeof(GovernanceError))] Err } } @@ -3311,7 +3245,7 @@ using System; namespace Test { - [Variant(typeof(Result5Tag))] + [Variant()] public class Result5 { [VariantTagProperty()] @@ -3363,9 +3297,7 @@ namespace Test public enum Result5Tag { - [VariantOptionType(typeof(NodeProvider))] Ok, - [VariantOptionType(typeof(GovernanceError))] Err } } @@ -3414,7 +3346,7 @@ using System; namespace Test { - [Variant(typeof(RewardModeTag))] + [Variant()] public class RewardMode { [VariantTagProperty()] @@ -3466,9 +3398,7 @@ namespace Test public enum RewardModeTag { - [VariantOptionType(typeof(RewardToNeuron))] RewardToNeuron, - [VariantOptionType(typeof(RewardToAccount))] RewardToAccount } } diff --git a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True.snap b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True.snap new file mode 100644 index 00000000..abdcb15e --- /dev/null +++ b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_True_KeepCandidCase_False_VariantsUseProperties_True.snap @@ -0,0 +1,2935 @@ +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 +{ + public class GovernanceApiClient + { + public IAgent Agent { get; } + + public Principal CanisterId { get; } + + public CandidConverter? Converter { get; } + + public GovernanceApiClient(IAgent agent, Principal canisterId, CandidConverter? converter = default) + { + this.Agent = agent; + this.CanisterId = canisterId; + this.Converter = converter; + } + + public async Task ClaimGtcNeurons(Principal arg0, List arg1) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0), CandidTypedValue.FromObject(arg1)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "claim_gtc_neurons", arg); + return reply.ToObjects(this.Converter); + } + + public async Task ClaimOrRefreshNeuronFromAccount(ClaimOrRefreshNeuronFromAccount arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "claim_or_refresh_neuron_from_account", arg); + return reply.ToObjects(this.Converter); + } + + public async Task GetBuildMetadata() + { + CandidArg arg = CandidArg.FromCandid(); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_build_metadata", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + + public async Task GetFullNeuron(ulong arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + + public async Task GetFullNeuronByIdOrSubaccount(NeuronIdOrSubaccount arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron_by_id_or_subaccount", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + + public async Task GetMonthlyNodeProviderRewards() + { + CandidArg arg = CandidArg.FromCandid(); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "get_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(); + 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(); + return reply.ToObjects>(this.Converter); + } + + public async Task GetNeuronInfo(ulong arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + + public async Task GetNeuronInfoByIdOrSubaccount(NeuronIdOrSubaccount arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info_by_id_or_subaccount", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + + public async Task GetNodeProviderByCaller(NullValue arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_node_provider_by_caller", arg); + CandidArg reply = response.ThrowOrGetReply(); + 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(); + return reply.ToObjects>(this.Converter); + } + + public async Task> GetProposalInfo(ulong arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_proposal_info", arg); + CandidArg reply = response.ThrowOrGetReply(); + 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(); + return reply.ToObjects(this.Converter); + } + + public async Task ListNeurons(ListNeurons arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_neurons", arg); + CandidArg reply = response.ThrowOrGetReply(); + 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(); + return reply.ToObjects(this.Converter); + } + + public async Task ListProposals(ListProposalInfo arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_proposals", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + + public async Task ManageNeuron(ManageNeuron arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "manage_neuron", arg); + return reply.ToObjects(this.Converter); + } + + public async Task TransferGtcNeuron(NeuronId arg0, NeuronId arg1) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0), CandidTypedValue.FromObject(arg1)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "transfer_gtc_neuron", arg); + return reply.ToObjects(this.Converter); + } + + public async Task UpdateNodeProvider(UpdateNodeProvider arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "update_node_provider", arg); + return reply.ToObjects(this.Converter); + } + } +} + +Type File: 'AccountIdentifier' + +using EdjCase.ICP.Candid.Mapping; +using System.Collections.Generic; + +namespace Test +{ + public class AccountIdentifier + { + [CandidName("hash")] + public List Hash { get; set; } + + public AccountIdentifier(List hash) + { + this.Hash = hash; + } + + public AccountIdentifier() + { + } + } +} + +Type File: 'Action' + +using EdjCase.ICP.Candid.Mapping; +using Test; + +namespace Test +{ + [Variant()] + public class Action + { + [VariantTagProperty()] + public ActionTag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public KnownNeuron? RegisterKnownNeuron { get => this.Tag == ActionTag.RegisterKnownNeuron ? (KnownNeuron)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.RegisterKnownNeuron, value); } + + public ManageNeuron? ManageNeuron { get => this.Tag == ActionTag.ManageNeuron ? (ManageNeuron)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.ManageNeuron, value); } + + public ExecuteNnsFunction? ExecuteNnsFunction { get => this.Tag == ActionTag.ExecuteNnsFunction ? (ExecuteNnsFunction)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.ExecuteNnsFunction, value); } + + public RewardNodeProvider? RewardNodeProvider { get => this.Tag == ActionTag.RewardNodeProvider ? (RewardNodeProvider)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.RewardNodeProvider, value); } + + public SetDefaultFollowees? SetDefaultFollowees { get => this.Tag == ActionTag.SetDefaultFollowees ? (SetDefaultFollowees)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.SetDefaultFollowees, value); } + + public RewardNodeProviders? RewardNodeProviders { get => this.Tag == ActionTag.RewardNodeProviders ? (RewardNodeProviders)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.RewardNodeProviders, value); } + + public NetworkEconomics? ManageNetworkEconomics { get => this.Tag == ActionTag.ManageNetworkEconomics ? (NetworkEconomics)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.ManageNetworkEconomics, value); } + + public ApproveGenesisKyc? ApproveGenesisKyc { get => this.Tag == ActionTag.ApproveGenesisKyc ? (ApproveGenesisKyc)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.ApproveGenesisKyc, value); } + + public AddOrRemoveNodeProvider? AddOrRemoveNodeProvider { get => this.Tag == ActionTag.AddOrRemoveNodeProvider ? (AddOrRemoveNodeProvider)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.AddOrRemoveNodeProvider, value); } + + public Motion? Motion { get => this.Tag == ActionTag.Motion ? (Motion)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.Motion, value); } + + public Action(ActionTag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected Action() + { + } + } + + public enum ActionTag + { + RegisterKnownNeuron, + ManageNeuron, + ExecuteNnsFunction, + RewardNodeProvider, + SetDefaultFollowees, + RewardNodeProviders, + ManageNetworkEconomics, + ApproveGenesisKyc, + AddOrRemoveNodeProvider, + Motion + } +} + +Type File: 'AddHotKey' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; + +namespace Test +{ + public class AddHotKey + { + [CandidName("new_hot_key")] + public OptionalValue NewHotKey { get; set; } + + public AddHotKey(OptionalValue newHotKey) + { + this.NewHotKey = newHotKey; + } + + public AddHotKey() + { + } + } +} + +Type File: 'AddOrRemoveNodeProvider' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class AddOrRemoveNodeProvider + { + [CandidName("change")] + public OptionalValue Change { get; set; } + + public AddOrRemoveNodeProvider(OptionalValue change) + { + this.Change = change; + } + + public AddOrRemoveNodeProvider() + { + } + } +} + +Type File: 'Amount' + +using EdjCase.ICP.Candid.Mapping; + +namespace Test +{ + public class Amount + { + [CandidName("e8s")] + public ulong E8s { get; set; } + + public Amount(ulong e8s) + { + this.E8s = e8s; + } + + public Amount() + { + } + } +} + +Type File: 'ApproveGenesisKyc' + +using EdjCase.ICP.Candid.Mapping; +using System.Collections.Generic; +using EdjCase.ICP.Candid.Models; + +namespace Test +{ + public class ApproveGenesisKyc + { + [CandidName("principals")] + public List Principals { get; set; } + + public ApproveGenesisKyc(List principals) + { + this.Principals = principals; + } + + public ApproveGenesisKyc() + { + } + } +} + +Type File: 'Ballot' + +using EdjCase.ICP.Candid.Mapping; + +namespace Test +{ + public class Ballot + { + [CandidName("vote")] + public int Vote { get; set; } + + [CandidName("voting_power")] + public ulong VotingPower { get; set; } + + public Ballot(int vote, ulong votingPower) + { + this.Vote = vote; + this.VotingPower = votingPower; + } + + public Ballot() + { + } + } +} + +Type File: 'BallotInfo' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class BallotInfo + { + [CandidName("vote")] + public int Vote { get; set; } + + [CandidName("proposal_id")] + public OptionalValue ProposalId { get; set; } + + public BallotInfo(int vote, OptionalValue proposalId) + { + this.Vote = vote; + this.ProposalId = proposalId; + } + + public BallotInfo() + { + } + } +} + +Type File: 'By' + +using EdjCase.ICP.Candid.Mapping; +using Test; + +namespace Test +{ + [Variant()] + public class By + { + [VariantTagProperty()] + public ByTag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public By.NeuronIdOrSubaccountInfo? NeuronIdOrSubaccount { get => this.Tag == ByTag.NeuronIdOrSubaccount ? (By.NeuronIdOrSubaccountInfo)this.Value! : default; set => (this.Tag, this.Value) = (ByTag.NeuronIdOrSubaccount, value); } + + public ClaimOrRefreshNeuronFromAccount? MemoAndController { get => this.Tag == ByTag.MemoAndController ? (ClaimOrRefreshNeuronFromAccount)this.Value! : default; set => (this.Tag, this.Value) = (ByTag.MemoAndController, value); } + + public ulong? Memo { get => this.Tag == ByTag.Memo ? (ulong)this.Value! : default; set => (this.Tag, this.Value) = (ByTag.Memo, value); } + + public By(ByTag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected By() + { + } + + public class NeuronIdOrSubaccountInfo + { + public NeuronIdOrSubaccountInfo() + { + } + } + } + + public enum ByTag + { + NeuronIdOrSubaccount, + MemoAndController, + Memo + } +} + +Type File: 'Change' + +using EdjCase.ICP.Candid.Mapping; +using Test; + +namespace Test +{ + [Variant()] + public class Change + { + [VariantTagProperty()] + public ChangeTag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public NodeProvider? ToRemove { get => this.Tag == ChangeTag.ToRemove ? (NodeProvider)this.Value! : default; set => (this.Tag, this.Value) = (ChangeTag.ToRemove, value); } + + public NodeProvider? ToAdd { get => this.Tag == ChangeTag.ToAdd ? (NodeProvider)this.Value! : default; set => (this.Tag, this.Value) = (ChangeTag.ToAdd, value); } + + public Change(ChangeTag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected Change() + { + } + } + + public enum ChangeTag + { + ToRemove, + ToAdd + } +} + +Type File: 'ClaimOrRefresh' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class ClaimOrRefresh + { + [CandidName("by")] + public OptionalValue By { get; set; } + + public ClaimOrRefresh(OptionalValue by) + { + this.By = by; + } + + public ClaimOrRefresh() + { + } + } +} + +Type File: 'ClaimOrRefreshNeuronFromAccount' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; + +namespace Test +{ + public class ClaimOrRefreshNeuronFromAccount + { + [CandidName("controller")] + public OptionalValue Controller { get; set; } + + [CandidName("memo")] + public ulong Memo { get; set; } + + public ClaimOrRefreshNeuronFromAccount(OptionalValue controller, ulong memo) + { + this.Controller = controller; + this.Memo = memo; + } + + public ClaimOrRefreshNeuronFromAccount() + { + } + } +} + +Type File: 'ClaimOrRefreshNeuronFromAccountResponse' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class ClaimOrRefreshNeuronFromAccountResponse + { + [CandidName("result")] + public OptionalValue Result { get; set; } + + public ClaimOrRefreshNeuronFromAccountResponse(OptionalValue result) + { + this.Result = result; + } + + public ClaimOrRefreshNeuronFromAccountResponse() + { + } + } +} + +Type File: 'ClaimOrRefreshResponse' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class ClaimOrRefreshResponse + { + [CandidName("refreshed_neuron_id")] + public OptionalValue RefreshedNeuronId { get; set; } + + public ClaimOrRefreshResponse(OptionalValue refreshedNeuronId) + { + this.RefreshedNeuronId = refreshedNeuronId; + } + + public ClaimOrRefreshResponse() + { + } + } +} + +Type File: 'Command' + +using EdjCase.ICP.Candid.Mapping; +using Test; + +namespace Test +{ + [Variant()] + public class Command + { + [VariantTagProperty()] + public CommandTag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public Spawn? Spawn { get => this.Tag == CommandTag.Spawn ? (Spawn)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.Spawn, value); } + + public Split? Split { get => this.Tag == CommandTag.Split ? (Split)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.Split, value); } + + public Follow? Follow { get => this.Tag == CommandTag.Follow ? (Follow)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.Follow, value); } + + public ClaimOrRefresh? ClaimOrRefresh { get => this.Tag == CommandTag.ClaimOrRefresh ? (ClaimOrRefresh)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.ClaimOrRefresh, value); } + + public Configure? Configure { get => this.Tag == CommandTag.Configure ? (Configure)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.Configure, value); } + + public RegisterVote? RegisterVote { get => this.Tag == CommandTag.RegisterVote ? (RegisterVote)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.RegisterVote, value); } + + public Merge? Merge { get => this.Tag == CommandTag.Merge ? (Merge)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.Merge, value); } + + public DisburseToNeuron? DisburseToNeuron { get => this.Tag == CommandTag.DisburseToNeuron ? (DisburseToNeuron)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.DisburseToNeuron, value); } + + public Proposal? MakeProposal { get => this.Tag == CommandTag.MakeProposal ? (Proposal)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.MakeProposal, value); } + + public MergeMaturity? MergeMaturity { get => this.Tag == CommandTag.MergeMaturity ? (MergeMaturity)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.MergeMaturity, value); } + + public Disburse? Disburse { get => this.Tag == CommandTag.Disburse ? (Disburse)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.Disburse, value); } + + public Command(CommandTag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected Command() + { + } + } + + public enum CommandTag + { + Spawn, + Split, + Follow, + ClaimOrRefresh, + Configure, + RegisterVote, + Merge, + DisburseToNeuron, + MakeProposal, + MergeMaturity, + Disburse + } +} + +Type File: 'Command1' + +using EdjCase.ICP.Candid.Mapping; +using Test; + +namespace Test +{ + [Variant()] + public class Command1 + { + [VariantTagProperty()] + public Command1Tag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public GovernanceError? Error { get => this.Tag == Command1Tag.Error ? (GovernanceError)this.Value! : default; set => (this.Tag, this.Value) = (Command1Tag.Error, value); } + + public SpawnResponse? Spawn { get => this.Tag == Command1Tag.Spawn ? (SpawnResponse)this.Value! : default; set => (this.Tag, this.Value) = (Command1Tag.Spawn, value); } + + public SpawnResponse? Split { get => this.Tag == Command1Tag.Split ? (SpawnResponse)this.Value! : default; set => (this.Tag, this.Value) = (Command1Tag.Split, value); } + + public Command1.FollowInfo? Follow { get => this.Tag == Command1Tag.Follow ? (Command1.FollowInfo)this.Value! : default; set => (this.Tag, this.Value) = (Command1Tag.Follow, value); } + + public ClaimOrRefreshResponse? ClaimOrRefresh { get => this.Tag == Command1Tag.ClaimOrRefresh ? (ClaimOrRefreshResponse)this.Value! : default; set => (this.Tag, this.Value) = (Command1Tag.ClaimOrRefresh, value); } + + public Command1.ConfigureInfo? Configure { get => this.Tag == Command1Tag.Configure ? (Command1.ConfigureInfo)this.Value! : default; set => (this.Tag, this.Value) = (Command1Tag.Configure, value); } + + public Command1.RegisterVoteInfo? RegisterVote { get => this.Tag == Command1Tag.RegisterVote ? (Command1.RegisterVoteInfo)this.Value! : default; set => (this.Tag, this.Value) = (Command1Tag.RegisterVote, value); } + + public Command1.MergeInfo? Merge { get => this.Tag == Command1Tag.Merge ? (Command1.MergeInfo)this.Value! : default; set => (this.Tag, this.Value) = (Command1Tag.Merge, value); } + + public SpawnResponse? DisburseToNeuron { get => this.Tag == Command1Tag.DisburseToNeuron ? (SpawnResponse)this.Value! : default; set => (this.Tag, this.Value) = (Command1Tag.DisburseToNeuron, value); } + + public MakeProposalResponse? MakeProposal { get => this.Tag == Command1Tag.MakeProposal ? (MakeProposalResponse)this.Value! : default; set => (this.Tag, this.Value) = (Command1Tag.MakeProposal, value); } + + public MergeMaturityResponse? MergeMaturity { get => this.Tag == Command1Tag.MergeMaturity ? (MergeMaturityResponse)this.Value! : default; set => (this.Tag, this.Value) = (Command1Tag.MergeMaturity, value); } + + public DisburseResponse? Disburse { get => this.Tag == Command1Tag.Disburse ? (DisburseResponse)this.Value! : default; set => (this.Tag, this.Value) = (Command1Tag.Disburse, value); } + + public Command1(Command1Tag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected Command1() + { + } + + public class FollowInfo + { + public FollowInfo() + { + } + } + + public class ConfigureInfo + { + public ConfigureInfo() + { + } + } + + public class RegisterVoteInfo + { + public RegisterVoteInfo() + { + } + } + + public class MergeInfo + { + public MergeInfo() + { + } + } + } + + public enum Command1Tag + { + Error, + Spawn, + Split, + Follow, + ClaimOrRefresh, + Configure, + RegisterVote, + Merge, + DisburseToNeuron, + MakeProposal, + MergeMaturity, + Disburse + } +} + +Type File: 'Command2' + +using EdjCase.ICP.Candid.Mapping; +using Test; + +namespace Test +{ + [Variant()] + public class Command2 + { + [VariantTagProperty()] + public Command2Tag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public Spawn? Spawn { get => this.Tag == Command2Tag.Spawn ? (Spawn)this.Value! : default; set => (this.Tag, this.Value) = (Command2Tag.Spawn, value); } + + public Split? Split { get => this.Tag == Command2Tag.Split ? (Split)this.Value! : default; set => (this.Tag, this.Value) = (Command2Tag.Split, value); } + + public Configure? Configure { get => this.Tag == Command2Tag.Configure ? (Configure)this.Value! : default; set => (this.Tag, this.Value) = (Command2Tag.Configure, value); } + + public Merge? Merge { get => this.Tag == Command2Tag.Merge ? (Merge)this.Value! : default; set => (this.Tag, this.Value) = (Command2Tag.Merge, value); } + + public DisburseToNeuron? DisburseToNeuron { get => this.Tag == Command2Tag.DisburseToNeuron ? (DisburseToNeuron)this.Value! : default; set => (this.Tag, this.Value) = (Command2Tag.DisburseToNeuron, value); } + + public ClaimOrRefresh? ClaimOrRefreshNeuron { get => this.Tag == Command2Tag.ClaimOrRefreshNeuron ? (ClaimOrRefresh)this.Value! : default; set => (this.Tag, this.Value) = (Command2Tag.ClaimOrRefreshNeuron, value); } + + public MergeMaturity? MergeMaturity { get => this.Tag == Command2Tag.MergeMaturity ? (MergeMaturity)this.Value! : default; set => (this.Tag, this.Value) = (Command2Tag.MergeMaturity, value); } + + public Disburse? Disburse { get => this.Tag == Command2Tag.Disburse ? (Disburse)this.Value! : default; set => (this.Tag, this.Value) = (Command2Tag.Disburse, value); } + + public Command2(Command2Tag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected Command2() + { + } + } + + public enum Command2Tag + { + Spawn, + Split, + Configure, + Merge, + DisburseToNeuron, + ClaimOrRefreshNeuron, + MergeMaturity, + Disburse + } +} + +Type File: 'Configure' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class Configure + { + [CandidName("operation")] + public OptionalValue Operation { get; set; } + + public Configure(OptionalValue operation) + { + this.Operation = operation; + } + + public Configure() + { + } + } +} + +Type File: 'Disburse' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class Disburse + { + [CandidName("to_account")] + public OptionalValue ToAccount { get; set; } + + [CandidName("amount")] + public OptionalValue Amount { get; set; } + + public Disburse(OptionalValue toAccount, OptionalValue amount) + { + this.ToAccount = toAccount; + this.Amount = amount; + } + + public Disburse() + { + } + } +} + +Type File: 'DisburseResponse' + +using EdjCase.ICP.Candid.Mapping; + +namespace Test +{ + public class DisburseResponse + { + [CandidName("transfer_block_height")] + public ulong TransferBlockHeight { get; set; } + + public DisburseResponse(ulong transferBlockHeight) + { + this.TransferBlockHeight = transferBlockHeight; + } + + public DisburseResponse() + { + } + } +} + +Type File: 'DisburseToNeuron' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; + +namespace Test +{ + public class DisburseToNeuron + { + [CandidName("dissolve_delay_seconds")] + public ulong DissolveDelaySeconds { get; set; } + + [CandidName("kyc_verified")] + public bool KycVerified { get; set; } + + [CandidName("amount_e8s")] + public ulong AmountE8s { get; set; } + + [CandidName("new_controller")] + public OptionalValue NewController { get; set; } + + [CandidName("nonce")] + public ulong Nonce { get; set; } + + public DisburseToNeuron(ulong dissolveDelaySeconds, bool kycVerified, ulong amountE8s, OptionalValue newController, ulong nonce) + { + this.DissolveDelaySeconds = dissolveDelaySeconds; + this.KycVerified = kycVerified; + this.AmountE8s = amountE8s; + this.NewController = newController; + this.Nonce = nonce; + } + + public DisburseToNeuron() + { + } + } +} + +Type File: 'DissolveState' + +using EdjCase.ICP.Candid.Mapping; +using Test; + +namespace Test +{ + [Variant()] + public class DissolveState + { + [VariantTagProperty()] + public DissolveStateTag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public ulong? DissolveDelaySeconds { get => this.Tag == DissolveStateTag.DissolveDelaySeconds ? (ulong)this.Value! : default; set => (this.Tag, this.Value) = (DissolveStateTag.DissolveDelaySeconds, value); } + + public ulong? WhenDissolvedTimestampSeconds { get => this.Tag == DissolveStateTag.WhenDissolvedTimestampSeconds ? (ulong)this.Value! : default; set => (this.Tag, this.Value) = (DissolveStateTag.WhenDissolvedTimestampSeconds, value); } + + public DissolveState(DissolveStateTag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected DissolveState() + { + } + } + + public enum DissolveStateTag + { + DissolveDelaySeconds, + WhenDissolvedTimestampSeconds + } +} + +Type File: 'ExecuteNnsFunction' + +using EdjCase.ICP.Candid.Mapping; +using System.Collections.Generic; + +namespace Test +{ + public class ExecuteNnsFunction + { + [CandidName("nns_function")] + public int NnsFunction { get; set; } + + [CandidName("payload")] + public List Payload { get; set; } + + public ExecuteNnsFunction(int nnsFunction, List payload) + { + this.NnsFunction = nnsFunction; + this.Payload = payload; + } + + public ExecuteNnsFunction() + { + } + } +} + +Type File: 'Follow' + +using EdjCase.ICP.Candid.Mapping; +using System.Collections.Generic; +using Test; + +namespace Test +{ + public class Follow + { + [CandidName("topic")] + public int Topic { get; set; } + + [CandidName("followees")] + public List Followees { get; set; } + + public Follow(int topic, List followees) + { + this.Topic = topic; + this.Followees = followees; + } + + public Follow() + { + } + } +} + +Type File: 'Followees' + +using EdjCase.ICP.Candid.Mapping; +using System.Collections.Generic; +using Test; + +namespace Test +{ + public class Followees + { + [CandidName("followees")] + public List Followees_ { get; set; } + + public Followees(List followees) + { + this.Followees_ = followees; + } + + public Followees() + { + } + } +} + +Type File: 'Governance' + +using EdjCase.ICP.Candid.Mapping; +using System.Collections.Generic; +using Test; +using EdjCase.ICP.Candid.Models; + +namespace Test +{ + public class Governance + { + [CandidName("default_followees")] + public Dictionary DefaultFollowees { get; set; } + + [CandidName("wait_for_quiet_threshold_seconds")] + public ulong WaitForQuietThresholdSeconds { get; set; } + + [CandidName("metrics")] + public OptionalValue Metrics { get; set; } + + [CandidName("node_providers")] + public List NodeProviders { get; set; } + + [CandidName("economics")] + public OptionalValue Economics { get; set; } + + [CandidName("latest_reward_event")] + public OptionalValue LatestRewardEvent { get; set; } + + [CandidName("to_claim_transfers")] + public List ToClaimTransfers { get; set; } + + [CandidName("short_voting_period_seconds")] + public ulong ShortVotingPeriodSeconds { get; set; } + + [CandidName("proposals")] + public Dictionary Proposals { get; set; } + + [CandidName("in_flight_commands")] + public Dictionary InFlightCommands { get; set; } + + [CandidName("neurons")] + public Dictionary Neurons { get; set; } + + [CandidName("genesis_timestamp_seconds")] + public ulong GenesisTimestampSeconds { get; set; } + + public Governance(Dictionary defaultFollowees, ulong waitForQuietThresholdSeconds, OptionalValue metrics, List nodeProviders, OptionalValue economics, OptionalValue latestRewardEvent, List toClaimTransfers, ulong shortVotingPeriodSeconds, Dictionary proposals, Dictionary inFlightCommands, Dictionary neurons, ulong genesisTimestampSeconds) + { + this.DefaultFollowees = defaultFollowees; + this.WaitForQuietThresholdSeconds = waitForQuietThresholdSeconds; + this.Metrics = metrics; + this.NodeProviders = nodeProviders; + this.Economics = economics; + this.LatestRewardEvent = latestRewardEvent; + this.ToClaimTransfers = toClaimTransfers; + this.ShortVotingPeriodSeconds = shortVotingPeriodSeconds; + this.Proposals = proposals; + this.InFlightCommands = inFlightCommands; + this.Neurons = neurons; + this.GenesisTimestampSeconds = genesisTimestampSeconds; + } + + public Governance() + { + } + } +} + +Type File: 'GovernanceCachedMetrics' + +using EdjCase.ICP.Candid.Mapping; +using System.Collections.Generic; + +namespace Test +{ + public class GovernanceCachedMetrics + { + [CandidName("not_dissolving_neurons_e8s_buckets")] + public Dictionary NotDissolvingNeuronsE8sBuckets { get; set; } + + [CandidName("garbage_collectable_neurons_count")] + public ulong GarbageCollectableNeuronsCount { get; set; } + + [CandidName("neurons_with_invalid_stake_count")] + public ulong NeuronsWithInvalidStakeCount { get; set; } + + [CandidName("not_dissolving_neurons_count_buckets")] + public Dictionary NotDissolvingNeuronsCountBuckets { get; set; } + + [CandidName("total_supply_icp")] + public ulong TotalSupplyIcp { get; set; } + + [CandidName("neurons_with_less_than_6_months_dissolve_delay_count")] + public ulong NeuronsWithLessThan6MonthsDissolveDelayCount { get; set; } + + [CandidName("dissolved_neurons_count")] + public ulong DissolvedNeuronsCount { get; set; } + + [CandidName("total_staked_e8s")] + public ulong TotalStakedE8s { get; set; } + + [CandidName("not_dissolving_neurons_count")] + public ulong NotDissolvingNeuronsCount { get; set; } + + [CandidName("dissolved_neurons_e8s")] + public ulong DissolvedNeuronsE8s { get; set; } + + [CandidName("neurons_with_less_than_6_months_dissolve_delay_e8s")] + public ulong NeuronsWithLessThan6MonthsDissolveDelayE8s { get; set; } + + [CandidName("dissolving_neurons_count_buckets")] + public Dictionary DissolvingNeuronsCountBuckets { get; set; } + + [CandidName("dissolving_neurons_count")] + public ulong DissolvingNeuronsCount { get; set; } + + [CandidName("dissolving_neurons_e8s_buckets")] + public Dictionary DissolvingNeuronsE8sBuckets { get; set; } + + [CandidName("community_fund_total_staked_e8s")] + public ulong CommunityFundTotalStakedE8s { get; set; } + + [CandidName("timestamp_seconds")] + public ulong TimestampSeconds { get; set; } + + public GovernanceCachedMetrics(Dictionary notDissolvingNeuronsE8sBuckets, ulong garbageCollectableNeuronsCount, ulong neuronsWithInvalidStakeCount, Dictionary notDissolvingNeuronsCountBuckets, ulong totalSupplyIcp, ulong neuronsWithLessThan6MonthsDissolveDelayCount, ulong dissolvedNeuronsCount, ulong totalStakedE8s, ulong notDissolvingNeuronsCount, ulong dissolvedNeuronsE8s, ulong neuronsWithLessThan6MonthsDissolveDelayE8s, Dictionary dissolvingNeuronsCountBuckets, ulong dissolvingNeuronsCount, Dictionary dissolvingNeuronsE8sBuckets, ulong communityFundTotalStakedE8s, ulong timestampSeconds) + { + this.NotDissolvingNeuronsE8sBuckets = notDissolvingNeuronsE8sBuckets; + this.GarbageCollectableNeuronsCount = garbageCollectableNeuronsCount; + this.NeuronsWithInvalidStakeCount = neuronsWithInvalidStakeCount; + this.NotDissolvingNeuronsCountBuckets = notDissolvingNeuronsCountBuckets; + this.TotalSupplyIcp = totalSupplyIcp; + this.NeuronsWithLessThan6MonthsDissolveDelayCount = neuronsWithLessThan6MonthsDissolveDelayCount; + this.DissolvedNeuronsCount = dissolvedNeuronsCount; + this.TotalStakedE8s = totalStakedE8s; + this.NotDissolvingNeuronsCount = notDissolvingNeuronsCount; + this.DissolvedNeuronsE8s = dissolvedNeuronsE8s; + this.NeuronsWithLessThan6MonthsDissolveDelayE8s = neuronsWithLessThan6MonthsDissolveDelayE8s; + this.DissolvingNeuronsCountBuckets = dissolvingNeuronsCountBuckets; + this.DissolvingNeuronsCount = dissolvingNeuronsCount; + this.DissolvingNeuronsE8sBuckets = dissolvingNeuronsE8sBuckets; + this.CommunityFundTotalStakedE8s = communityFundTotalStakedE8s; + this.TimestampSeconds = timestampSeconds; + } + + public GovernanceCachedMetrics() + { + } + } +} + +Type File: 'GovernanceError' + +using EdjCase.ICP.Candid.Mapping; + +namespace Test +{ + public class GovernanceError + { + [CandidName("error_message")] + public string ErrorMessage { get; set; } + + [CandidName("error_type")] + public int ErrorType { get; set; } + + public GovernanceError(string errorMessage, int errorType) + { + this.ErrorMessage = errorMessage; + this.ErrorType = errorType; + } + + public GovernanceError() + { + } + } +} + +Type File: 'IncreaseDissolveDelay' + +using EdjCase.ICP.Candid.Mapping; + +namespace Test +{ + public class IncreaseDissolveDelay + { + [CandidName("additional_dissolve_delay_seconds")] + public uint AdditionalDissolveDelaySeconds { get; set; } + + public IncreaseDissolveDelay(uint additionalDissolveDelaySeconds) + { + this.AdditionalDissolveDelaySeconds = additionalDissolveDelaySeconds; + } + + public IncreaseDissolveDelay() + { + } + } +} + +Type File: 'KnownNeuron' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class KnownNeuron + { + [CandidName("id")] + public OptionalValue Id { get; set; } + + [CandidName("known_neuron_data")] + public OptionalValue KnownNeuronData { get; set; } + + public KnownNeuron(OptionalValue id, OptionalValue knownNeuronData) + { + this.Id = id; + this.KnownNeuronData = knownNeuronData; + } + + public KnownNeuron() + { + } + } +} + +Type File: 'KnownNeuronData' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; + +namespace Test +{ + public class KnownNeuronData + { + [CandidName("name")] + public string Name { get; set; } + + [CandidName("description")] + public OptionalValue Description { get; set; } + + public KnownNeuronData(string name, OptionalValue description) + { + this.Name = name; + this.Description = description; + } + + public KnownNeuronData() + { + } + } +} + +Type File: 'ListKnownNeuronsResponse' + +using EdjCase.ICP.Candid.Mapping; +using System.Collections.Generic; +using Test; + +namespace Test +{ + public class ListKnownNeuronsResponse + { + [CandidName("known_neurons")] + public List KnownNeurons { get; set; } + + public ListKnownNeuronsResponse(List knownNeurons) + { + this.KnownNeurons = knownNeurons; + } + + public ListKnownNeuronsResponse() + { + } + } +} + +Type File: 'ListNeurons' + +using EdjCase.ICP.Candid.Mapping; +using System.Collections.Generic; + +namespace Test +{ + public class ListNeurons + { + [CandidName("neuron_ids")] + public List NeuronIds { get; set; } + + [CandidName("include_neurons_readable_by_caller")] + public bool IncludeNeuronsReadableByCaller { get; set; } + + public ListNeurons(List neuronIds, bool includeNeuronsReadableByCaller) + { + this.NeuronIds = neuronIds; + this.IncludeNeuronsReadableByCaller = includeNeuronsReadableByCaller; + } + + public ListNeurons() + { + } + } +} + +Type File: 'ListNeuronsResponse' + +using EdjCase.ICP.Candid.Mapping; +using System.Collections.Generic; +using Test; + +namespace Test +{ + public class ListNeuronsResponse + { + [CandidName("neuron_infos")] + public Dictionary NeuronInfos { get; set; } + + [CandidName("full_neurons")] + public List FullNeurons { get; set; } + + public ListNeuronsResponse(Dictionary neuronInfos, List fullNeurons) + { + this.NeuronInfos = neuronInfos; + this.FullNeurons = fullNeurons; + } + + public ListNeuronsResponse() + { + } + } +} + +Type File: 'ListNodeProvidersResponse' + +using EdjCase.ICP.Candid.Mapping; +using System.Collections.Generic; +using Test; + +namespace Test +{ + public class ListNodeProvidersResponse + { + [CandidName("node_providers")] + public List NodeProviders { get; set; } + + public ListNodeProvidersResponse(List nodeProviders) + { + this.NodeProviders = nodeProviders; + } + + public ListNodeProvidersResponse() + { + } + } +} + +Type File: 'ListProposalInfo' + +using EdjCase.ICP.Candid.Mapping; +using System.Collections.Generic; +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class ListProposalInfo + { + [CandidName("include_reward_status")] + public List IncludeRewardStatus { get; set; } + + [CandidName("before_proposal")] + public OptionalValue BeforeProposal { get; set; } + + [CandidName("limit")] + public uint Limit { get; set; } + + [CandidName("exclude_topic")] + public List ExcludeTopic { get; set; } + + [CandidName("include_status")] + public List IncludeStatus { get; set; } + + public ListProposalInfo(List includeRewardStatus, OptionalValue beforeProposal, uint limit, List excludeTopic, List includeStatus) + { + this.IncludeRewardStatus = includeRewardStatus; + this.BeforeProposal = beforeProposal; + this.Limit = limit; + this.ExcludeTopic = excludeTopic; + this.IncludeStatus = includeStatus; + } + + public ListProposalInfo() + { + } + } +} + +Type File: 'ListProposalInfoResponse' + +using EdjCase.ICP.Candid.Mapping; +using System.Collections.Generic; +using Test; + +namespace Test +{ + public class ListProposalInfoResponse + { + [CandidName("proposal_info")] + public List ProposalInfo { get; set; } + + public ListProposalInfoResponse(List proposalInfo) + { + this.ProposalInfo = proposalInfo; + } + + public ListProposalInfoResponse() + { + } + } +} + +Type File: 'MakeProposalResponse' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class MakeProposalResponse + { + [CandidName("proposal_id")] + public OptionalValue ProposalId { get; set; } + + public MakeProposalResponse(OptionalValue proposalId) + { + this.ProposalId = proposalId; + } + + public MakeProposalResponse() + { + } + } +} + +Type File: 'ManageNeuron' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class ManageNeuron + { + [CandidName("id")] + public OptionalValue Id { get; set; } + + [CandidName("command")] + public OptionalValue Command { get; set; } + + [CandidName("neuron_id_or_subaccount")] + public OptionalValue NeuronIdOrSubaccount { get; set; } + + public ManageNeuron(OptionalValue id, OptionalValue command, OptionalValue neuronIdOrSubaccount) + { + this.Id = id; + this.Command = command; + this.NeuronIdOrSubaccount = neuronIdOrSubaccount; + } + + public ManageNeuron() + { + } + } +} + +Type File: 'ManageNeuronResponse' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class ManageNeuronResponse + { + [CandidName("command")] + public OptionalValue Command { get; set; } + + public ManageNeuronResponse(OptionalValue command) + { + this.Command = command; + } + + public ManageNeuronResponse() + { + } + } +} + +Type File: 'Merge' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class Merge + { + [CandidName("source_neuron_id")] + public OptionalValue SourceNeuronId { get; set; } + + public Merge(OptionalValue sourceNeuronId) + { + this.SourceNeuronId = sourceNeuronId; + } + + public Merge() + { + } + } +} + +Type File: 'MergeMaturity' + +using EdjCase.ICP.Candid.Mapping; + +namespace Test +{ + public class MergeMaturity + { + [CandidName("percentage_to_merge")] + public uint PercentageToMerge { get; set; } + + public MergeMaturity(uint percentageToMerge) + { + this.PercentageToMerge = percentageToMerge; + } + + public MergeMaturity() + { + } + } +} + +Type File: 'MergeMaturityResponse' + +using EdjCase.ICP.Candid.Mapping; + +namespace Test +{ + public class MergeMaturityResponse + { + [CandidName("merged_maturity_e8s")] + public ulong MergedMaturityE8s { get; set; } + + [CandidName("new_stake_e8s")] + public ulong NewStakeE8s { get; set; } + + public MergeMaturityResponse(ulong mergedMaturityE8s, ulong newStakeE8s) + { + this.MergedMaturityE8s = mergedMaturityE8s; + this.NewStakeE8s = newStakeE8s; + } + + public MergeMaturityResponse() + { + } + } +} + +Type File: 'Motion' + +using EdjCase.ICP.Candid.Mapping; + +namespace Test +{ + public class Motion + { + [CandidName("motion_text")] + public string MotionText { get; set; } + + public Motion(string motionText) + { + this.MotionText = motionText; + } + + public Motion() + { + } + } +} + +Type File: 'NetworkEconomics' + +using EdjCase.ICP.Candid.Mapping; + +namespace Test +{ + public class NetworkEconomics + { + [CandidName("neuron_minimum_stake_e8s")] + public ulong NeuronMinimumStakeE8s { get; set; } + + [CandidName("max_proposals_to_keep_per_topic")] + public uint MaxProposalsToKeepPerTopic { get; set; } + + [CandidName("neuron_management_fee_per_proposal_e8s")] + public ulong NeuronManagementFeePerProposalE8s { get; set; } + + [CandidName("reject_cost_e8s")] + public ulong RejectCostE8s { get; set; } + + [CandidName("transaction_fee_e8s")] + public ulong TransactionFeeE8s { get; set; } + + [CandidName("neuron_spawn_dissolve_delay_seconds")] + public ulong NeuronSpawnDissolveDelaySeconds { get; set; } + + [CandidName("minimum_icp_xdr_rate")] + public ulong MinimumIcpXdrRate { get; set; } + + [CandidName("maximum_node_provider_rewards_e8s")] + public ulong MaximumNodeProviderRewardsE8s { get; set; } + + public NetworkEconomics(ulong neuronMinimumStakeE8s, uint maxProposalsToKeepPerTopic, ulong neuronManagementFeePerProposalE8s, ulong rejectCostE8s, ulong transactionFeeE8s, ulong neuronSpawnDissolveDelaySeconds, ulong minimumIcpXdrRate, ulong maximumNodeProviderRewardsE8s) + { + this.NeuronMinimumStakeE8s = neuronMinimumStakeE8s; + this.MaxProposalsToKeepPerTopic = maxProposalsToKeepPerTopic; + this.NeuronManagementFeePerProposalE8s = neuronManagementFeePerProposalE8s; + this.RejectCostE8s = rejectCostE8s; + this.TransactionFeeE8s = transactionFeeE8s; + this.NeuronSpawnDissolveDelaySeconds = neuronSpawnDissolveDelaySeconds; + this.MinimumIcpXdrRate = minimumIcpXdrRate; + this.MaximumNodeProviderRewardsE8s = maximumNodeProviderRewardsE8s; + } + + public NetworkEconomics() + { + } + } +} + +Type File: 'Neuron' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test; +using System.Collections.Generic; + +namespace Test +{ + public class Neuron + { + [CandidName("id")] + public OptionalValue Id { get; set; } + + [CandidName("controller")] + public OptionalValue Controller { get; set; } + + [CandidName("recent_ballots")] + public List RecentBallots { get; set; } + + [CandidName("kyc_verified")] + public bool KycVerified { get; set; } + + [CandidName("not_for_profit")] + public bool NotForProfit { get; set; } + + [CandidName("maturity_e8s_equivalent")] + public ulong MaturityE8sEquivalent { get; set; } + + [CandidName("cached_neuron_stake_e8s")] + public ulong CachedNeuronStakeE8s { get; set; } + + [CandidName("created_timestamp_seconds")] + public ulong CreatedTimestampSeconds { get; set; } + + [CandidName("aging_since_timestamp_seconds")] + public ulong AgingSinceTimestampSeconds { get; set; } + + [CandidName("hot_keys")] + public List HotKeys { get; set; } + + [CandidName("account")] + public List Account { get; set; } + + [CandidName("joined_community_fund_timestamp_seconds")] + public OptionalValue JoinedCommunityFundTimestampSeconds { get; set; } + + [CandidName("dissolve_state")] + public OptionalValue DissolveState { get; set; } + + [CandidName("followees")] + public Dictionary Followees { get; set; } + + [CandidName("neuron_fees_e8s")] + public ulong NeuronFeesE8s { get; set; } + + [CandidName("transfer")] + public OptionalValue Transfer { get; set; } + + [CandidName("known_neuron_data")] + public OptionalValue KnownNeuronData { get; set; } + + public Neuron(OptionalValue id, OptionalValue controller, List recentBallots, bool kycVerified, bool notForProfit, ulong maturityE8sEquivalent, ulong cachedNeuronStakeE8s, ulong createdTimestampSeconds, ulong agingSinceTimestampSeconds, List hotKeys, List account, OptionalValue joinedCommunityFundTimestampSeconds, OptionalValue dissolveState, Dictionary followees, ulong neuronFeesE8s, OptionalValue transfer, OptionalValue knownNeuronData) + { + this.Id = id; + this.Controller = controller; + this.RecentBallots = recentBallots; + this.KycVerified = kycVerified; + this.NotForProfit = notForProfit; + this.MaturityE8sEquivalent = maturityE8sEquivalent; + this.CachedNeuronStakeE8s = cachedNeuronStakeE8s; + this.CreatedTimestampSeconds = createdTimestampSeconds; + this.AgingSinceTimestampSeconds = agingSinceTimestampSeconds; + this.HotKeys = hotKeys; + this.Account = account; + this.JoinedCommunityFundTimestampSeconds = joinedCommunityFundTimestampSeconds; + this.DissolveState = dissolveState; + this.Followees = followees; + this.NeuronFeesE8s = neuronFeesE8s; + this.Transfer = transfer; + this.KnownNeuronData = knownNeuronData; + } + + public Neuron() + { + } + } +} + +Type File: 'NeuronId' + +using EdjCase.ICP.Candid.Mapping; + +namespace Test +{ + public class NeuronId + { + [CandidName("id")] + public ulong Id { get; set; } + + public NeuronId(ulong id) + { + this.Id = id; + } + + public NeuronId() + { + } + } +} + +Type File: 'NeuronIdOrSubaccount' + +using EdjCase.ICP.Candid.Mapping; +using Test; +using System.Collections.Generic; + +namespace Test +{ + [Variant()] + public class NeuronIdOrSubaccount + { + [VariantTagProperty()] + public NeuronIdOrSubaccountTag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public List? Subaccount { get => this.Tag == NeuronIdOrSubaccountTag.Subaccount ? (List)this.Value! : default; set => (this.Tag, this.Value) = (NeuronIdOrSubaccountTag.Subaccount, value); } + + public NeuronId? NeuronId { get => this.Tag == NeuronIdOrSubaccountTag.NeuronId ? (NeuronId)this.Value! : default; set => (this.Tag, this.Value) = (NeuronIdOrSubaccountTag.NeuronId, value); } + + public NeuronIdOrSubaccount(NeuronIdOrSubaccountTag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected NeuronIdOrSubaccount() + { + } + } + + public enum NeuronIdOrSubaccountTag + { + Subaccount, + NeuronId + } +} + +Type File: 'NeuronInFlightCommand' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class NeuronInFlightCommand + { + [CandidName("command")] + public OptionalValue Command { get; set; } + + [CandidName("timestamp")] + public ulong Timestamp { get; set; } + + public NeuronInFlightCommand(OptionalValue command, ulong timestamp) + { + this.Command = command; + this.Timestamp = timestamp; + } + + public NeuronInFlightCommand() + { + } + } +} + +Type File: 'NeuronInfo' + +using EdjCase.ICP.Candid.Mapping; +using System.Collections.Generic; +using Test; +using EdjCase.ICP.Candid.Models; + +namespace Test +{ + public class NeuronInfo + { + [CandidName("dissolve_delay_seconds")] + public ulong DissolveDelaySeconds { get; set; } + + [CandidName("recent_ballots")] + public List RecentBallots { get; set; } + + [CandidName("created_timestamp_seconds")] + public ulong CreatedTimestampSeconds { get; set; } + + [CandidName("state")] + public int State { get; set; } + + [CandidName("stake_e8s")] + public ulong StakeE8s { get; set; } + + [CandidName("joined_community_fund_timestamp_seconds")] + public OptionalValue JoinedCommunityFundTimestampSeconds { get; set; } + + [CandidName("retrieved_at_timestamp_seconds")] + public ulong RetrievedAtTimestampSeconds { get; set; } + + [CandidName("known_neuron_data")] + public OptionalValue KnownNeuronData { get; set; } + + [CandidName("voting_power")] + public ulong VotingPower { get; set; } + + [CandidName("age_seconds")] + public ulong AgeSeconds { get; set; } + + public NeuronInfo(ulong dissolveDelaySeconds, List recentBallots, ulong createdTimestampSeconds, int state, ulong stakeE8s, OptionalValue joinedCommunityFundTimestampSeconds, ulong retrievedAtTimestampSeconds, OptionalValue knownNeuronData, ulong votingPower, ulong ageSeconds) + { + this.DissolveDelaySeconds = dissolveDelaySeconds; + this.RecentBallots = recentBallots; + this.CreatedTimestampSeconds = createdTimestampSeconds; + this.State = state; + this.StakeE8s = stakeE8s; + this.JoinedCommunityFundTimestampSeconds = joinedCommunityFundTimestampSeconds; + this.RetrievedAtTimestampSeconds = retrievedAtTimestampSeconds; + this.KnownNeuronData = knownNeuronData; + this.VotingPower = votingPower; + this.AgeSeconds = ageSeconds; + } + + public NeuronInfo() + { + } + } +} + +Type File: 'NeuronStakeTransfer' + +using EdjCase.ICP.Candid.Mapping; +using System.Collections.Generic; +using EdjCase.ICP.Candid.Models; + +namespace Test +{ + public class NeuronStakeTransfer + { + [CandidName("to_subaccount")] + public List ToSubaccount { get; set; } + + [CandidName("neuron_stake_e8s")] + public ulong NeuronStakeE8s { get; set; } + + [CandidName("from")] + public OptionalValue From { get; set; } + + [CandidName("memo")] + public ulong Memo { get; set; } + + [CandidName("from_subaccount")] + public List FromSubaccount { get; set; } + + [CandidName("transfer_timestamp")] + public ulong TransferTimestamp { get; set; } + + [CandidName("block_height")] + public ulong BlockHeight { get; set; } + + public NeuronStakeTransfer(List toSubaccount, ulong neuronStakeE8s, OptionalValue from, ulong memo, List fromSubaccount, ulong transferTimestamp, ulong blockHeight) + { + this.ToSubaccount = toSubaccount; + this.NeuronStakeE8s = neuronStakeE8s; + this.From = from; + this.Memo = memo; + this.FromSubaccount = fromSubaccount; + this.TransferTimestamp = transferTimestamp; + this.BlockHeight = blockHeight; + } + + public NeuronStakeTransfer() + { + } + } +} + +Type File: 'NodeProvider' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class NodeProvider + { + [CandidName("id")] + public OptionalValue Id { get; set; } + + [CandidName("reward_account")] + public OptionalValue RewardAccount { get; set; } + + public NodeProvider(OptionalValue id, OptionalValue rewardAccount) + { + this.Id = id; + this.RewardAccount = rewardAccount; + } + + public NodeProvider() + { + } + } +} + +Type File: 'Operation' + +using EdjCase.ICP.Candid.Mapping; +using Test; + +namespace Test +{ + [Variant()] + public class Operation + { + [VariantTagProperty()] + public OperationTag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public RemoveHotKey? RemoveHotKey { get => this.Tag == OperationTag.RemoveHotKey ? (RemoveHotKey)this.Value! : default; set => (this.Tag, this.Value) = (OperationTag.RemoveHotKey, value); } + + public AddHotKey? AddHotKey { get => this.Tag == OperationTag.AddHotKey ? (AddHotKey)this.Value! : default; set => (this.Tag, this.Value) = (OperationTag.AddHotKey, value); } + + public Operation.StopDissolvingInfo? StopDissolving { get => this.Tag == OperationTag.StopDissolving ? (Operation.StopDissolvingInfo)this.Value! : default; set => (this.Tag, this.Value) = (OperationTag.StopDissolving, value); } + + public Operation.StartDissolvingInfo? StartDissolving { get => this.Tag == OperationTag.StartDissolving ? (Operation.StartDissolvingInfo)this.Value! : default; set => (this.Tag, this.Value) = (OperationTag.StartDissolving, value); } + + public IncreaseDissolveDelay? IncreaseDissolveDelay { get => this.Tag == OperationTag.IncreaseDissolveDelay ? (IncreaseDissolveDelay)this.Value! : default; set => (this.Tag, this.Value) = (OperationTag.IncreaseDissolveDelay, value); } + + public Operation.JoinCommunityFundInfo? JoinCommunityFund { get => this.Tag == OperationTag.JoinCommunityFund ? (Operation.JoinCommunityFundInfo)this.Value! : default; set => (this.Tag, this.Value) = (OperationTag.JoinCommunityFund, value); } + + public SetDissolveTimestamp? SetDissolveTimestamp { get => this.Tag == OperationTag.SetDissolveTimestamp ? (SetDissolveTimestamp)this.Value! : default; set => (this.Tag, this.Value) = (OperationTag.SetDissolveTimestamp, value); } + + public Operation(OperationTag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected Operation() + { + } + + public class StopDissolvingInfo + { + public StopDissolvingInfo() + { + } + } + + public class StartDissolvingInfo + { + public StartDissolvingInfo() + { + } + } + + public class JoinCommunityFundInfo + { + public JoinCommunityFundInfo() + { + } + } + } + + public enum OperationTag + { + RemoveHotKey, + AddHotKey, + StopDissolving, + StartDissolving, + IncreaseDissolveDelay, + JoinCommunityFund, + SetDissolveTimestamp + } +} + +Type File: 'Proposal' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class Proposal + { + [CandidName("url")] + public string Url { get; set; } + + [CandidName("title")] + public OptionalValue Title { get; set; } + + [CandidName("action")] + public OptionalValue Action { get; set; } + + [CandidName("summary")] + public string Summary { get; set; } + + public Proposal(string url, OptionalValue title, OptionalValue action, string summary) + { + this.Url = url; + this.Title = title; + this.Action = action; + this.Summary = summary; + } + + public Proposal() + { + } + } +} + +Type File: 'ProposalData' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test; +using System.Collections.Generic; + +namespace Test +{ + public class ProposalData + { + [CandidName("id")] + public OptionalValue Id { get; set; } + + [CandidName("failure_reason")] + public OptionalValue FailureReason { get; set; } + + [CandidName("ballots")] + public Dictionary Ballots { get; set; } + + [CandidName("proposal_timestamp_seconds")] + public ulong ProposalTimestampSeconds { get; set; } + + [CandidName("reward_event_round")] + public ulong RewardEventRound { get; set; } + + [CandidName("failed_timestamp_seconds")] + public ulong FailedTimestampSeconds { get; set; } + + [CandidName("reject_cost_e8s")] + public ulong RejectCostE8s { get; set; } + + [CandidName("latest_tally")] + public OptionalValue LatestTally { get; set; } + + [CandidName("decided_timestamp_seconds")] + public ulong DecidedTimestampSeconds { get; set; } + + [CandidName("proposal")] + public OptionalValue Proposal { get; set; } + + [CandidName("proposer")] + public OptionalValue Proposer { get; set; } + + [CandidName("wait_for_quiet_state")] + public OptionalValue WaitForQuietState { get; set; } + + [CandidName("executed_timestamp_seconds")] + public ulong ExecutedTimestampSeconds { get; set; } + + public ProposalData(OptionalValue id, OptionalValue failureReason, Dictionary ballots, ulong proposalTimestampSeconds, ulong rewardEventRound, ulong failedTimestampSeconds, ulong rejectCostE8s, OptionalValue latestTally, ulong decidedTimestampSeconds, OptionalValue proposal, OptionalValue proposer, OptionalValue waitForQuietState, ulong executedTimestampSeconds) + { + this.Id = id; + this.FailureReason = failureReason; + this.Ballots = ballots; + this.ProposalTimestampSeconds = proposalTimestampSeconds; + this.RewardEventRound = rewardEventRound; + this.FailedTimestampSeconds = failedTimestampSeconds; + this.RejectCostE8s = rejectCostE8s; + this.LatestTally = latestTally; + this.DecidedTimestampSeconds = decidedTimestampSeconds; + this.Proposal = proposal; + this.Proposer = proposer; + this.WaitForQuietState = waitForQuietState; + this.ExecutedTimestampSeconds = executedTimestampSeconds; + } + + public ProposalData() + { + } + } +} + +Type File: 'ProposalInfo' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test; +using System.Collections.Generic; + +namespace Test +{ + public class ProposalInfo + { + [CandidName("id")] + public OptionalValue Id { get; set; } + + [CandidName("status")] + public int Status { get; set; } + + [CandidName("topic")] + public int Topic { get; set; } + + [CandidName("failure_reason")] + public OptionalValue FailureReason { get; set; } + + [CandidName("ballots")] + public Dictionary Ballots { get; set; } + + [CandidName("proposal_timestamp_seconds")] + public ulong ProposalTimestampSeconds { get; set; } + + [CandidName("reward_event_round")] + public ulong RewardEventRound { get; set; } + + [CandidName("deadline_timestamp_seconds")] + public OptionalValue DeadlineTimestampSeconds { get; set; } + + [CandidName("failed_timestamp_seconds")] + public ulong FailedTimestampSeconds { get; set; } + + [CandidName("reject_cost_e8s")] + public ulong RejectCostE8s { get; set; } + + [CandidName("latest_tally")] + public OptionalValue LatestTally { get; set; } + + [CandidName("reward_status")] + public int RewardStatus { get; set; } + + [CandidName("decided_timestamp_seconds")] + public ulong DecidedTimestampSeconds { get; set; } + + [CandidName("proposal")] + public OptionalValue Proposal { get; set; } + + [CandidName("proposer")] + public OptionalValue Proposer { get; set; } + + [CandidName("executed_timestamp_seconds")] + public ulong ExecutedTimestampSeconds { get; set; } + + public ProposalInfo(OptionalValue id, int status, int topic, OptionalValue failureReason, Dictionary ballots, ulong proposalTimestampSeconds, ulong rewardEventRound, OptionalValue deadlineTimestampSeconds, ulong failedTimestampSeconds, ulong rejectCostE8s, OptionalValue latestTally, int rewardStatus, ulong decidedTimestampSeconds, OptionalValue proposal, OptionalValue proposer, ulong executedTimestampSeconds) + { + this.Id = id; + this.Status = status; + this.Topic = topic; + this.FailureReason = failureReason; + this.Ballots = ballots; + this.ProposalTimestampSeconds = proposalTimestampSeconds; + this.RewardEventRound = rewardEventRound; + this.DeadlineTimestampSeconds = deadlineTimestampSeconds; + this.FailedTimestampSeconds = failedTimestampSeconds; + this.RejectCostE8s = rejectCostE8s; + this.LatestTally = latestTally; + this.RewardStatus = rewardStatus; + this.DecidedTimestampSeconds = decidedTimestampSeconds; + this.Proposal = proposal; + this.Proposer = proposer; + this.ExecutedTimestampSeconds = executedTimestampSeconds; + } + + public ProposalInfo() + { + } + } +} + +Type File: 'RegisterVote' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class RegisterVote + { + [CandidName("vote")] + public int Vote { get; set; } + + [CandidName("proposal")] + public OptionalValue Proposal { get; set; } + + public RegisterVote(int vote, OptionalValue proposal) + { + this.Vote = vote; + this.Proposal = proposal; + } + + public RegisterVote() + { + } + } +} + +Type File: 'RemoveHotKey' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; + +namespace Test +{ + public class RemoveHotKey + { + [CandidName("hot_key_to_remove")] + public OptionalValue HotKeyToRemove { get; set; } + + public RemoveHotKey(OptionalValue hotKeyToRemove) + { + this.HotKeyToRemove = hotKeyToRemove; + } + + public RemoveHotKey() + { + } + } +} + +Type File: 'Result' + +using EdjCase.ICP.Candid.Mapping; +using Test; + +namespace Test +{ + [Variant()] + public class Result + { + [VariantTagProperty()] + public ResultTag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public GovernanceError? Err { get => this.Tag == ResultTag.Err ? (GovernanceError)this.Value! : default; set => (this.Tag, this.Value) = (ResultTag.Err, value); } + + public Result(ResultTag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected Result() + { + } + } + + public enum ResultTag + { + Ok, + Err + } +} + +Type File: 'Result1' + +using EdjCase.ICP.Candid.Mapping; +using Test; + +namespace Test +{ + [Variant()] + public class Result1 + { + [VariantTagProperty()] + public Result1Tag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public GovernanceError? Error { get => this.Tag == Result1Tag.Error ? (GovernanceError)this.Value! : default; set => (this.Tag, this.Value) = (Result1Tag.Error, value); } + + public NeuronId? NeuronId { get => this.Tag == Result1Tag.NeuronId ? (NeuronId)this.Value! : default; set => (this.Tag, this.Value) = (Result1Tag.NeuronId, value); } + + public Result1(Result1Tag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected Result1() + { + } + } + + public enum Result1Tag + { + Error, + NeuronId + } +} + +Type File: 'Result2' + +using EdjCase.ICP.Candid.Mapping; +using Test; + +namespace Test +{ + [Variant()] + public class Result2 + { + [VariantTagProperty()] + public Result2Tag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public Neuron? Ok { get => this.Tag == Result2Tag.Ok ? (Neuron)this.Value! : default; set => (this.Tag, this.Value) = (Result2Tag.Ok, value); } + + public GovernanceError? Err { get => this.Tag == Result2Tag.Err ? (GovernanceError)this.Value! : default; set => (this.Tag, this.Value) = (Result2Tag.Err, value); } + + public Result2(Result2Tag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected Result2() + { + } + } + + public enum Result2Tag + { + Ok, + Err + } +} + +Type File: 'Result3' + +using EdjCase.ICP.Candid.Mapping; +using Test; + +namespace Test +{ + [Variant()] + public class Result3 + { + [VariantTagProperty()] + public Result3Tag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public RewardNodeProviders? Ok { get => this.Tag == Result3Tag.Ok ? (RewardNodeProviders)this.Value! : default; set => (this.Tag, this.Value) = (Result3Tag.Ok, value); } + + public GovernanceError? Err { get => this.Tag == Result3Tag.Err ? (GovernanceError)this.Value! : default; set => (this.Tag, this.Value) = (Result3Tag.Err, value); } + + public Result3(Result3Tag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected Result3() + { + } + } + + public enum Result3Tag + { + Ok, + Err + } +} + +Type File: 'Result4' + +using EdjCase.ICP.Candid.Mapping; +using Test; + +namespace Test +{ + [Variant()] + public class Result4 + { + [VariantTagProperty()] + public Result4Tag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public NeuronInfo? Ok { get => this.Tag == Result4Tag.Ok ? (NeuronInfo)this.Value! : default; set => (this.Tag, this.Value) = (Result4Tag.Ok, value); } + + public GovernanceError? Err { get => this.Tag == Result4Tag.Err ? (GovernanceError)this.Value! : default; set => (this.Tag, this.Value) = (Result4Tag.Err, value); } + + public Result4(Result4Tag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected Result4() + { + } + } + + public enum Result4Tag + { + Ok, + Err + } +} + +Type File: 'Result5' + +using EdjCase.ICP.Candid.Mapping; +using Test; + +namespace Test +{ + [Variant()] + public class Result5 + { + [VariantTagProperty()] + public Result5Tag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public NodeProvider? Ok { get => this.Tag == Result5Tag.Ok ? (NodeProvider)this.Value! : default; set => (this.Tag, this.Value) = (Result5Tag.Ok, value); } + + public GovernanceError? Err { get => this.Tag == Result5Tag.Err ? (GovernanceError)this.Value! : default; set => (this.Tag, this.Value) = (Result5Tag.Err, value); } + + public Result5(Result5Tag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected Result5() + { + } + } + + public enum Result5Tag + { + Ok, + Err + } +} + +Type File: 'RewardEvent' + +using EdjCase.ICP.Candid.Mapping; +using System.Collections.Generic; +using Test; + +namespace Test +{ + public class RewardEvent + { + [CandidName("day_after_genesis")] + public ulong DayAfterGenesis { get; set; } + + [CandidName("actual_timestamp_seconds")] + public ulong ActualTimestampSeconds { get; set; } + + [CandidName("distributed_e8s_equivalent")] + public ulong DistributedE8sEquivalent { get; set; } + + [CandidName("settled_proposals")] + public List SettledProposals { get; set; } + + public RewardEvent(ulong dayAfterGenesis, ulong actualTimestampSeconds, ulong distributedE8sEquivalent, List settledProposals) + { + this.DayAfterGenesis = dayAfterGenesis; + this.ActualTimestampSeconds = actualTimestampSeconds; + this.DistributedE8sEquivalent = distributedE8sEquivalent; + this.SettledProposals = settledProposals; + } + + public RewardEvent() + { + } + } +} + +Type File: 'RewardMode' + +using EdjCase.ICP.Candid.Mapping; +using Test; + +namespace Test +{ + [Variant()] + public class RewardMode + { + [VariantTagProperty()] + public RewardModeTag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public RewardToNeuron? RewardToNeuron { get => this.Tag == RewardModeTag.RewardToNeuron ? (RewardToNeuron)this.Value! : default; set => (this.Tag, this.Value) = (RewardModeTag.RewardToNeuron, value); } + + public RewardToAccount? RewardToAccount { get => this.Tag == RewardModeTag.RewardToAccount ? (RewardToAccount)this.Value! : default; set => (this.Tag, this.Value) = (RewardModeTag.RewardToAccount, value); } + + public RewardMode(RewardModeTag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected RewardMode() + { + } + } + + public enum RewardModeTag + { + RewardToNeuron, + RewardToAccount + } +} + +Type File: 'RewardNodeProvider' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class RewardNodeProvider + { + [CandidName("node_provider")] + public OptionalValue NodeProvider { get; set; } + + [CandidName("reward_mode")] + public OptionalValue RewardMode { get; set; } + + [CandidName("amount_e8s")] + public ulong AmountE8s { get; set; } + + public RewardNodeProvider(OptionalValue nodeProvider, OptionalValue rewardMode, ulong amountE8s) + { + this.NodeProvider = nodeProvider; + this.RewardMode = rewardMode; + this.AmountE8s = amountE8s; + } + + public RewardNodeProvider() + { + } + } +} + +Type File: 'RewardNodeProviders' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using System.Collections.Generic; +using Test; + +namespace Test +{ + public class RewardNodeProviders + { + [CandidName("use_registry_derived_rewards")] + public OptionalValue UseRegistryDerivedRewards { get; set; } + + [CandidName("rewards")] + public List Rewards { get; set; } + + public RewardNodeProviders(OptionalValue useRegistryDerivedRewards, List rewards) + { + this.UseRegistryDerivedRewards = useRegistryDerivedRewards; + this.Rewards = rewards; + } + + public RewardNodeProviders() + { + } + } +} + +Type File: 'RewardToAccount' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class RewardToAccount + { + [CandidName("to_account")] + public OptionalValue ToAccount { get; set; } + + public RewardToAccount(OptionalValue toAccount) + { + this.ToAccount = toAccount; + } + + public RewardToAccount() + { + } + } +} + +Type File: 'RewardToNeuron' + +using EdjCase.ICP.Candid.Mapping; + +namespace Test +{ + public class RewardToNeuron + { + [CandidName("dissolve_delay_seconds")] + public ulong DissolveDelaySeconds { get; set; } + + public RewardToNeuron(ulong dissolveDelaySeconds) + { + this.DissolveDelaySeconds = dissolveDelaySeconds; + } + + public RewardToNeuron() + { + } + } +} + +Type File: 'SetDefaultFollowees' + +using EdjCase.ICP.Candid.Mapping; +using System.Collections.Generic; +using Test; + +namespace Test +{ + public class SetDefaultFollowees + { + [CandidName("default_followees")] + public Dictionary DefaultFollowees { get; set; } + + public SetDefaultFollowees(Dictionary defaultFollowees) + { + this.DefaultFollowees = defaultFollowees; + } + + public SetDefaultFollowees() + { + } + } +} + +Type File: 'SetDissolveTimestamp' + +using EdjCase.ICP.Candid.Mapping; + +namespace Test +{ + public class SetDissolveTimestamp + { + [CandidName("dissolve_timestamp_seconds")] + public ulong DissolveTimestampSeconds { get; set; } + + public SetDissolveTimestamp(ulong dissolveTimestampSeconds) + { + this.DissolveTimestampSeconds = dissolveTimestampSeconds; + } + + public SetDissolveTimestamp() + { + } + } +} + +Type File: 'Spawn' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; + +namespace Test +{ + public class Spawn + { + [CandidName("percentage_to_spawn")] + public OptionalValue PercentageToSpawn { get; set; } + + [CandidName("new_controller")] + public OptionalValue NewController { get; set; } + + [CandidName("nonce")] + public OptionalValue Nonce { get; set; } + + public Spawn(OptionalValue percentageToSpawn, OptionalValue newController, OptionalValue nonce) + { + this.PercentageToSpawn = percentageToSpawn; + this.NewController = newController; + this.Nonce = nonce; + } + + public Spawn() + { + } + } +} + +Type File: 'SpawnResponse' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class SpawnResponse + { + [CandidName("created_neuron_id")] + public OptionalValue CreatedNeuronId { get; set; } + + public SpawnResponse(OptionalValue createdNeuronId) + { + this.CreatedNeuronId = createdNeuronId; + } + + public SpawnResponse() + { + } + } +} + +Type File: 'Split' + +using EdjCase.ICP.Candid.Mapping; + +namespace Test +{ + public class Split + { + [CandidName("amount_e8s")] + public ulong AmountE8s { get; set; } + + public Split(ulong amountE8s) + { + this.AmountE8s = amountE8s; + } + + public Split() + { + } + } +} + +Type File: 'Tally' + +using EdjCase.ICP.Candid.Mapping; + +namespace Test +{ + public class Tally + { + [CandidName("no")] + public ulong No { get; set; } + + [CandidName("yes")] + public ulong Yes { get; set; } + + [CandidName("total")] + public ulong Total { get; set; } + + [CandidName("timestamp_seconds")] + public ulong TimestampSeconds { get; set; } + + public Tally(ulong no, ulong yes, ulong total, ulong timestampSeconds) + { + this.No = no; + this.Yes = yes; + this.Total = total; + this.TimestampSeconds = timestampSeconds; + } + + public Tally() + { + } + } +} + +Type File: 'UpdateNodeProvider' + +using EdjCase.ICP.Candid.Mapping; +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class UpdateNodeProvider + { + [CandidName("reward_account")] + public OptionalValue RewardAccount { get; set; } + + public UpdateNodeProvider(OptionalValue rewardAccount) + { + this.RewardAccount = rewardAccount; + } + + public UpdateNodeProvider() + { + } + } +} + +Type File: 'WaitForQuietState' + +using EdjCase.ICP.Candid.Mapping; + +namespace Test +{ + public class WaitForQuietState + { + [CandidName("current_deadline_timestamp_seconds")] + public ulong CurrentDeadlineTimestampSeconds { get; set; } + + public WaitForQuietState(ulong currentDeadlineTimestampSeconds) + { + this.CurrentDeadlineTimestampSeconds = currentDeadlineTimestampSeconds; + } + + public WaitForQuietState() + { + } + } +} diff --git a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_True_KeepCandidCase_True.snap b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False.snap similarity index 95% rename from test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_True_KeepCandidCase_True.snap rename to test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False.snap index 046b9314..cd38a5ef 100644 --- a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_True_KeepCandidCase_True.snap +++ b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_False.snap @@ -208,7 +208,7 @@ using System; namespace Test { - [Variant(typeof(ActionTag))] + [Variant()] public class Action { [VariantTagProperty()] @@ -348,25 +348,15 @@ namespace Test public enum ActionTag { - [VariantOptionType(typeof(KnownNeuron))] RegisterKnownNeuron, - [VariantOptionType(typeof(ManageNeuron))] ManageNeuron, - [VariantOptionType(typeof(ExecuteNnsFunction))] ExecuteNnsFunction, - [VariantOptionType(typeof(RewardNodeProvider))] RewardNodeProvider, - [VariantOptionType(typeof(SetDefaultFollowees))] SetDefaultFollowees, - [VariantOptionType(typeof(RewardNodeProviders))] RewardNodeProviders, - [VariantOptionType(typeof(NetworkEconomics))] ManageNetworkEconomics, - [VariantOptionType(typeof(ApproveGenesisKyc))] ApproveGenesisKyc, - [VariantOptionType(typeof(AddOrRemoveNodeProvider))] AddOrRemoveNodeProvider, - [VariantOptionType(typeof(Motion))] Motion } } @@ -510,7 +500,7 @@ using System; namespace Test { - [Variant(typeof(ByTag))] + [Variant()] public class By { [VariantTagProperty()] @@ -580,11 +570,8 @@ namespace Test public enum ByTag { - [VariantOptionType(typeof(By.NeuronIdOrSubaccountInfo))] NeuronIdOrSubaccount, - [VariantOptionType(typeof(ClaimOrRefreshNeuronFromAccount))] MemoAndController, - [VariantOptionType(typeof(ulong))] Memo } } @@ -597,7 +584,7 @@ using System; namespace Test { - [Variant(typeof(ChangeTag))] + [Variant()] public class Change { [VariantTagProperty()] @@ -649,9 +636,7 @@ namespace Test public enum ChangeTag { - [VariantOptionType(typeof(NodeProvider))] ToRemove, - [VariantOptionType(typeof(NodeProvider))] ToAdd } } @@ -754,7 +739,7 @@ using System; namespace Test { - [Variant(typeof(CommandTag))] + [Variant()] public class Command { [VariantTagProperty()] @@ -905,27 +890,16 @@ namespace Test public enum CommandTag { - [VariantOptionType(typeof(Spawn))] Spawn, - [VariantOptionType(typeof(Split))] Split, - [VariantOptionType(typeof(Follow))] Follow, - [VariantOptionType(typeof(ClaimOrRefresh))] ClaimOrRefresh, - [VariantOptionType(typeof(Configure))] Configure, - [VariantOptionType(typeof(RegisterVote))] RegisterVote, - [VariantOptionType(typeof(Merge))] Merge, - [VariantOptionType(typeof(DisburseToNeuron))] DisburseToNeuron, - [VariantOptionType(typeof(Proposal))] MakeProposal, - [VariantOptionType(typeof(MergeMaturity))] MergeMaturity, - [VariantOptionType(typeof(Disburse))] Disburse } } @@ -938,7 +912,7 @@ using System; namespace Test { - [Variant(typeof(Command_1Tag))] + [Variant()] public class Command_1 { [VariantTagProperty()] @@ -1128,29 +1102,17 @@ namespace Test public enum Command_1Tag { - [VariantOptionType(typeof(GovernanceError))] Error, - [VariantOptionType(typeof(SpawnResponse))] Spawn, - [VariantOptionType(typeof(SpawnResponse))] Split, - [VariantOptionType(typeof(Command_1.FollowInfo))] Follow, - [VariantOptionType(typeof(ClaimOrRefreshResponse))] ClaimOrRefresh, - [VariantOptionType(typeof(Command_1.ConfigureInfo))] Configure, - [VariantOptionType(typeof(Command_1.RegisterVoteInfo))] RegisterVote, - [VariantOptionType(typeof(Command_1.MergeInfo))] Merge, - [VariantOptionType(typeof(SpawnResponse))] DisburseToNeuron, - [VariantOptionType(typeof(MakeProposalResponse))] MakeProposal, - [VariantOptionType(typeof(MergeMaturityResponse))] MergeMaturity, - [VariantOptionType(typeof(DisburseResponse))] Disburse } } @@ -1163,7 +1125,7 @@ using System; namespace Test { - [Variant(typeof(Command_2Tag))] + [Variant()] public class Command_2 { [VariantTagProperty()] @@ -1281,21 +1243,13 @@ namespace Test public enum Command_2Tag { - [VariantOptionType(typeof(Spawn))] Spawn, - [VariantOptionType(typeof(Split))] Split, - [VariantOptionType(typeof(Configure))] Configure, - [VariantOptionType(typeof(Merge))] Merge, - [VariantOptionType(typeof(DisburseToNeuron))] DisburseToNeuron, - [VariantOptionType(typeof(ClaimOrRefresh))] ClaimOrRefreshNeuron, - [VariantOptionType(typeof(MergeMaturity))] MergeMaturity, - [VariantOptionType(typeof(Disburse))] Disburse } } @@ -1407,7 +1361,7 @@ using System; namespace Test { - [Variant(typeof(DissolveStateTag))] + [Variant()] public class DissolveState { [VariantTagProperty()] @@ -1459,9 +1413,7 @@ namespace Test public enum DissolveStateTag { - [VariantOptionType(typeof(ulong))] DissolveDelaySeconds, - [VariantOptionType(typeof(ulong))] WhenDissolvedTimestampSeconds } } @@ -2192,7 +2144,7 @@ using System; namespace Test { - [Variant(typeof(NeuronIdOrSubaccountTag))] + [Variant()] public class NeuronIdOrSubaccount { [VariantTagProperty()] @@ -2244,9 +2196,7 @@ namespace Test public enum NeuronIdOrSubaccountTag { - [VariantOptionType(typeof(List))] Subaccount, - [VariantOptionType(typeof(NeuronId))] NeuronId } } @@ -2399,7 +2349,7 @@ using System; namespace Test { - [Variant(typeof(OperationTag))] + [Variant()] public class Operation { [VariantTagProperty()] @@ -2527,19 +2477,12 @@ namespace Test public enum OperationTag { - [VariantOptionType(typeof(RemoveHotKey))] RemoveHotKey, - [VariantOptionType(typeof(AddHotKey))] AddHotKey, - [VariantOptionType(typeof(Operation.StopDissolvingInfo))] StopDissolving, - [VariantOptionType(typeof(Operation.StartDissolvingInfo))] StartDissolving, - [VariantOptionType(typeof(IncreaseDissolveDelay))] IncreaseDissolveDelay, - [VariantOptionType(typeof(Operation.JoinCommunityFundInfo))] JoinCommunityFund, - [VariantOptionType(typeof(SetDissolveTimestamp))] SetDissolveTimestamp } } @@ -2756,7 +2699,7 @@ using System; namespace Test { - [Variant(typeof(ResultTag))] + [Variant()] public class Result { [VariantTagProperty()] @@ -2803,7 +2746,6 @@ namespace Test public enum ResultTag { Ok, - [VariantOptionType(typeof(GovernanceError))] Err } } @@ -2816,7 +2758,7 @@ using System; namespace Test { - [Variant(typeof(Result_1Tag))] + [Variant()] public class Result_1 { [VariantTagProperty()] @@ -2868,9 +2810,7 @@ namespace Test public enum Result_1Tag { - [VariantOptionType(typeof(GovernanceError))] Error, - [VariantOptionType(typeof(NeuronId))] NeuronId } } @@ -2883,7 +2823,7 @@ using System; namespace Test { - [Variant(typeof(Result_2Tag))] + [Variant()] public class Result_2 { [VariantTagProperty()] @@ -2935,9 +2875,7 @@ namespace Test public enum Result_2Tag { - [VariantOptionType(typeof(Neuron))] Ok, - [VariantOptionType(typeof(GovernanceError))] Err } } @@ -2950,7 +2888,7 @@ using System; namespace Test { - [Variant(typeof(Result_3Tag))] + [Variant()] public class Result_3 { [VariantTagProperty()] @@ -3002,9 +2940,7 @@ namespace Test public enum Result_3Tag { - [VariantOptionType(typeof(RewardNodeProviders))] Ok, - [VariantOptionType(typeof(GovernanceError))] Err } } @@ -3017,7 +2953,7 @@ using System; namespace Test { - [Variant(typeof(Result_4Tag))] + [Variant()] public class Result_4 { [VariantTagProperty()] @@ -3069,9 +3005,7 @@ namespace Test public enum Result_4Tag { - [VariantOptionType(typeof(NeuronInfo))] Ok, - [VariantOptionType(typeof(GovernanceError))] Err } } @@ -3084,7 +3018,7 @@ using System; namespace Test { - [Variant(typeof(Result_5Tag))] + [Variant()] public class Result_5 { [VariantTagProperty()] @@ -3136,9 +3070,7 @@ namespace Test public enum Result_5Tag { - [VariantOptionType(typeof(NodeProvider))] Ok, - [VariantOptionType(typeof(GovernanceError))] Err } } @@ -3182,7 +3114,7 @@ using System; namespace Test { - [Variant(typeof(RewardModeTag))] + [Variant()] public class RewardMode { [VariantTagProperty()] @@ -3234,9 +3166,7 @@ namespace Test public enum RewardModeTag { - [VariantOptionType(typeof(RewardToNeuron))] RewardToNeuron, - [VariantOptionType(typeof(RewardToAccount))] RewardToAccount } } diff --git a/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True.snap b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True.snap new file mode 100644 index 00000000..d68b2e18 --- /dev/null +++ b/test/Candid.Tests/Generators/__snapshots__/Governance_NoFolders_True_Nullable_True_KeepCandidCase_True_VariantsUseProperties_True.snap @@ -0,0 +1,2666 @@ +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 +{ + public class GovernanceApiClient + { + public IAgent Agent { get; } + + public Principal CanisterId { get; } + + public CandidConverter? Converter { get; } + + public GovernanceApiClient(IAgent agent, Principal canisterId, CandidConverter? converter = default) + { + this.Agent = agent; + this.CanisterId = canisterId; + this.Converter = converter; + } + + public async Task claim_gtc_neurons(Principal arg0, List arg1) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0), CandidTypedValue.FromObject(arg1)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "claim_gtc_neurons", arg); + return reply.ToObjects(this.Converter); + } + + public async Task claim_or_refresh_neuron_from_account(ClaimOrRefreshNeuronFromAccount arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "claim_or_refresh_neuron_from_account", arg); + return reply.ToObjects(this.Converter); + } + + 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(); + return reply.ToObjects(this.Converter); + } + + public async Task _get_full_neuron(ulong arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + + public async Task _get_full_neuron_by_id_or_subaccount(NeuronIdOrSubaccount arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_full_neuron_by_id_or_subaccount", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + + public async Task _get_monthly_node_provider_rewards() + { + CandidArg arg = CandidArg.FromCandid(); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "get_monthly_node_provider_rewards", arg); + return reply.ToObjects(this.Converter); + } + + 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(); + 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(); + return reply.ToObjects>(this.Converter); + } + + public async Task _get_neuron_info(ulong arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + + public async Task _get_neuron_info_by_id_or_subaccount(NeuronIdOrSubaccount arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_neuron_info_by_id_or_subaccount", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + + public async Task _get_node_provider_by_caller(NullValue arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_node_provider_by_caller", arg); + CandidArg reply = response.ThrowOrGetReply(); + 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(); + return reply.ToObjects>(this.Converter); + } + + public async Task> _get_proposal_info(ulong arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "get_proposal_info", arg); + CandidArg reply = response.ThrowOrGetReply(); + 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(); + return reply.ToObjects(this.Converter); + } + + public async Task list_neurons(ListNeurons arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_neurons", arg); + CandidArg reply = response.ThrowOrGetReply(); + 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(); + return reply.ToObjects(this.Converter); + } + + public async Task list_proposals(ListProposalInfo arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + QueryResponse response = await this.Agent.QueryAsync(this.CanisterId, "list_proposals", arg); + CandidArg reply = response.ThrowOrGetReply(); + return reply.ToObjects(this.Converter); + } + + public async Task manage_neuron(ManageNeuron arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "manage_neuron", arg); + return reply.ToObjects(this.Converter); + } + + public async Task transfer_gtc_neuron(NeuronId arg0, NeuronId arg1) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0), CandidTypedValue.FromObject(arg1)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "transfer_gtc_neuron", arg); + return reply.ToObjects(this.Converter); + } + + public async Task update_node_provider(UpdateNodeProvider arg0) + { + CandidArg arg = CandidArg.FromCandid(CandidTypedValue.FromObject(arg0)); + CandidArg reply = await this.Agent.CallAndWaitAsync(this.CanisterId, "update_node_provider", arg); + return reply.ToObjects(this.Converter); + } + } +} + +Type File: 'AccountIdentifier' + +using System.Collections.Generic; + +namespace Test +{ + public class AccountIdentifier + { + public List hash { get; set; } + + public AccountIdentifier(List hash) + { + this.hash = hash; + } + + public AccountIdentifier() + { + } + } +} + +Type File: 'Action' + +using EdjCase.ICP.Candid.Mapping; +using Test; + +namespace Test +{ + [Variant()] + public class Action + { + [VariantTagProperty()] + public ActionTag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public KnownNeuron? RegisterKnownNeuron { get => this.Tag == ActionTag.RegisterKnownNeuron ? (KnownNeuron)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.RegisterKnownNeuron, value); } + + public ManageNeuron? ManageNeuron { get => this.Tag == ActionTag.ManageNeuron ? (ManageNeuron)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.ManageNeuron, value); } + + public ExecuteNnsFunction? ExecuteNnsFunction { get => this.Tag == ActionTag.ExecuteNnsFunction ? (ExecuteNnsFunction)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.ExecuteNnsFunction, value); } + + public RewardNodeProvider? RewardNodeProvider { get => this.Tag == ActionTag.RewardNodeProvider ? (RewardNodeProvider)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.RewardNodeProvider, value); } + + public SetDefaultFollowees? SetDefaultFollowees { get => this.Tag == ActionTag.SetDefaultFollowees ? (SetDefaultFollowees)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.SetDefaultFollowees, value); } + + public RewardNodeProviders? RewardNodeProviders { get => this.Tag == ActionTag.RewardNodeProviders ? (RewardNodeProviders)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.RewardNodeProviders, value); } + + public NetworkEconomics? ManageNetworkEconomics { get => this.Tag == ActionTag.ManageNetworkEconomics ? (NetworkEconomics)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.ManageNetworkEconomics, value); } + + public ApproveGenesisKyc? ApproveGenesisKyc { get => this.Tag == ActionTag.ApproveGenesisKyc ? (ApproveGenesisKyc)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.ApproveGenesisKyc, value); } + + public AddOrRemoveNodeProvider? AddOrRemoveNodeProvider { get => this.Tag == ActionTag.AddOrRemoveNodeProvider ? (AddOrRemoveNodeProvider)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.AddOrRemoveNodeProvider, value); } + + public Motion? Motion { get => this.Tag == ActionTag.Motion ? (Motion)this.Value! : default; set => (this.Tag, this.Value) = (ActionTag.Motion, value); } + + public Action(ActionTag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected Action() + { + } + } + + public enum ActionTag + { + RegisterKnownNeuron, + ManageNeuron, + ExecuteNnsFunction, + RewardNodeProvider, + SetDefaultFollowees, + RewardNodeProviders, + ManageNetworkEconomics, + ApproveGenesisKyc, + AddOrRemoveNodeProvider, + Motion + } +} + +Type File: 'AddHotKey' + +using EdjCase.ICP.Candid.Models; + +namespace Test +{ + public class AddHotKey + { + public OptionalValue new_hot_key { get; set; } + + public AddHotKey(OptionalValue newHotKey) + { + this.new_hot_key = newHotKey; + } + + public AddHotKey() + { + } + } +} + +Type File: 'AddOrRemoveNodeProvider' + +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class AddOrRemoveNodeProvider + { + public OptionalValue change { get; set; } + + public AddOrRemoveNodeProvider(OptionalValue change) + { + this.change = change; + } + + public AddOrRemoveNodeProvider() + { + } + } +} + +Type File: 'Amount' + +namespace Test +{ + public class Amount + { + public ulong e8s { get; set; } + + public Amount(ulong e8s) + { + this.e8s = e8s; + } + + public Amount() + { + } + } +} + +Type File: 'ApproveGenesisKyc' + +using System.Collections.Generic; +using EdjCase.ICP.Candid.Models; + +namespace Test +{ + public class ApproveGenesisKyc + { + public List principals { get; set; } + + public ApproveGenesisKyc(List principals) + { + this.principals = principals; + } + + public ApproveGenesisKyc() + { + } + } +} + +Type File: 'Ballot' + +namespace Test +{ + public class Ballot + { + public int vote { get; set; } + + public ulong voting_power { get; set; } + + public Ballot(int vote, ulong votingPower) + { + this.vote = vote; + this.voting_power = votingPower; + } + + public Ballot() + { + } + } +} + +Type File: 'BallotInfo' + +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class BallotInfo + { + public int vote { get; set; } + + public OptionalValue proposal_id { get; set; } + + public BallotInfo(int vote, OptionalValue proposalId) + { + this.vote = vote; + this.proposal_id = proposalId; + } + + public BallotInfo() + { + } + } +} + +Type File: 'By' + +using EdjCase.ICP.Candid.Mapping; +using Test; + +namespace Test +{ + [Variant()] + public class By + { + [VariantTagProperty()] + public ByTag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public By.NeuronIdOrSubaccountInfo? NeuronIdOrSubaccount { get => this.Tag == ByTag.NeuronIdOrSubaccount ? (By.NeuronIdOrSubaccountInfo)this.Value! : default; set => (this.Tag, this.Value) = (ByTag.NeuronIdOrSubaccount, value); } + + public ClaimOrRefreshNeuronFromAccount? MemoAndController { get => this.Tag == ByTag.MemoAndController ? (ClaimOrRefreshNeuronFromAccount)this.Value! : default; set => (this.Tag, this.Value) = (ByTag.MemoAndController, value); } + + public ulong? Memo { get => this.Tag == ByTag.Memo ? (ulong)this.Value! : default; set => (this.Tag, this.Value) = (ByTag.Memo, value); } + + public By(ByTag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected By() + { + } + + public class NeuronIdOrSubaccountInfo + { + public NeuronIdOrSubaccountInfo() + { + } + } + } + + public enum ByTag + { + NeuronIdOrSubaccount, + MemoAndController, + Memo + } +} + +Type File: 'Change' + +using EdjCase.ICP.Candid.Mapping; +using Test; + +namespace Test +{ + [Variant()] + public class Change + { + [VariantTagProperty()] + public ChangeTag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public NodeProvider? ToRemove { get => this.Tag == ChangeTag.ToRemove ? (NodeProvider)this.Value! : default; set => (this.Tag, this.Value) = (ChangeTag.ToRemove, value); } + + public NodeProvider? ToAdd { get => this.Tag == ChangeTag.ToAdd ? (NodeProvider)this.Value! : default; set => (this.Tag, this.Value) = (ChangeTag.ToAdd, value); } + + public Change(ChangeTag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected Change() + { + } + } + + public enum ChangeTag + { + ToRemove, + ToAdd + } +} + +Type File: 'ClaimOrRefresh' + +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class ClaimOrRefresh + { + public OptionalValue by { get; set; } + + public ClaimOrRefresh(OptionalValue by) + { + this.by = by; + } + + public ClaimOrRefresh() + { + } + } +} + +Type File: 'ClaimOrRefreshNeuronFromAccount' + +using EdjCase.ICP.Candid.Models; + +namespace Test +{ + public class ClaimOrRefreshNeuronFromAccount + { + public OptionalValue controller { get; set; } + + public ulong memo { get; set; } + + public ClaimOrRefreshNeuronFromAccount(OptionalValue controller, ulong memo) + { + this.controller = controller; + this.memo = memo; + } + + public ClaimOrRefreshNeuronFromAccount() + { + } + } +} + +Type File: 'ClaimOrRefreshNeuronFromAccountResponse' + +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class ClaimOrRefreshNeuronFromAccountResponse + { + public OptionalValue result { get; set; } + + public ClaimOrRefreshNeuronFromAccountResponse(OptionalValue result) + { + this.result = result; + } + + public ClaimOrRefreshNeuronFromAccountResponse() + { + } + } +} + +Type File: 'ClaimOrRefreshResponse' + +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class ClaimOrRefreshResponse + { + public OptionalValue refreshed_neuron_id { get; set; } + + public ClaimOrRefreshResponse(OptionalValue refreshedNeuronId) + { + this.refreshed_neuron_id = refreshedNeuronId; + } + + public ClaimOrRefreshResponse() + { + } + } +} + +Type File: 'Command' + +using EdjCase.ICP.Candid.Mapping; +using Test; + +namespace Test +{ + [Variant()] + public class Command + { + [VariantTagProperty()] + public CommandTag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public Spawn? Spawn { get => this.Tag == CommandTag.Spawn ? (Spawn)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.Spawn, value); } + + public Split? Split { get => this.Tag == CommandTag.Split ? (Split)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.Split, value); } + + public Follow? Follow { get => this.Tag == CommandTag.Follow ? (Follow)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.Follow, value); } + + public ClaimOrRefresh? ClaimOrRefresh { get => this.Tag == CommandTag.ClaimOrRefresh ? (ClaimOrRefresh)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.ClaimOrRefresh, value); } + + public Configure? Configure { get => this.Tag == CommandTag.Configure ? (Configure)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.Configure, value); } + + public RegisterVote? RegisterVote { get => this.Tag == CommandTag.RegisterVote ? (RegisterVote)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.RegisterVote, value); } + + public Merge? Merge { get => this.Tag == CommandTag.Merge ? (Merge)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.Merge, value); } + + public DisburseToNeuron? DisburseToNeuron { get => this.Tag == CommandTag.DisburseToNeuron ? (DisburseToNeuron)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.DisburseToNeuron, value); } + + public Proposal? MakeProposal { get => this.Tag == CommandTag.MakeProposal ? (Proposal)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.MakeProposal, value); } + + public MergeMaturity? MergeMaturity { get => this.Tag == CommandTag.MergeMaturity ? (MergeMaturity)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.MergeMaturity, value); } + + public Disburse? Disburse { get => this.Tag == CommandTag.Disburse ? (Disburse)this.Value! : default; set => (this.Tag, this.Value) = (CommandTag.Disburse, value); } + + public Command(CommandTag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected Command() + { + } + } + + public enum CommandTag + { + Spawn, + Split, + Follow, + ClaimOrRefresh, + Configure, + RegisterVote, + Merge, + DisburseToNeuron, + MakeProposal, + MergeMaturity, + Disburse + } +} + +Type File: 'Command_1' + +using EdjCase.ICP.Candid.Mapping; +using Test; + +namespace Test +{ + [Variant()] + public class Command_1 + { + [VariantTagProperty()] + public Command_1Tag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public GovernanceError? Error { get => this.Tag == Command_1Tag.Error ? (GovernanceError)this.Value! : default; set => (this.Tag, this.Value) = (Command_1Tag.Error, value); } + + public SpawnResponse? Spawn { get => this.Tag == Command_1Tag.Spawn ? (SpawnResponse)this.Value! : default; set => (this.Tag, this.Value) = (Command_1Tag.Spawn, value); } + + public SpawnResponse? Split { get => this.Tag == Command_1Tag.Split ? (SpawnResponse)this.Value! : default; set => (this.Tag, this.Value) = (Command_1Tag.Split, value); } + + public Command_1.FollowInfo? Follow { get => this.Tag == Command_1Tag.Follow ? (Command_1.FollowInfo)this.Value! : default; set => (this.Tag, this.Value) = (Command_1Tag.Follow, value); } + + public ClaimOrRefreshResponse? ClaimOrRefresh { get => this.Tag == Command_1Tag.ClaimOrRefresh ? (ClaimOrRefreshResponse)this.Value! : default; set => (this.Tag, this.Value) = (Command_1Tag.ClaimOrRefresh, value); } + + public Command_1.ConfigureInfo? Configure { get => this.Tag == Command_1Tag.Configure ? (Command_1.ConfigureInfo)this.Value! : default; set => (this.Tag, this.Value) = (Command_1Tag.Configure, value); } + + public Command_1.RegisterVoteInfo? RegisterVote { get => this.Tag == Command_1Tag.RegisterVote ? (Command_1.RegisterVoteInfo)this.Value! : default; set => (this.Tag, this.Value) = (Command_1Tag.RegisterVote, value); } + + public Command_1.MergeInfo? Merge { get => this.Tag == Command_1Tag.Merge ? (Command_1.MergeInfo)this.Value! : default; set => (this.Tag, this.Value) = (Command_1Tag.Merge, value); } + + public SpawnResponse? DisburseToNeuron { get => this.Tag == Command_1Tag.DisburseToNeuron ? (SpawnResponse)this.Value! : default; set => (this.Tag, this.Value) = (Command_1Tag.DisburseToNeuron, value); } + + public MakeProposalResponse? MakeProposal { get => this.Tag == Command_1Tag.MakeProposal ? (MakeProposalResponse)this.Value! : default; set => (this.Tag, this.Value) = (Command_1Tag.MakeProposal, value); } + + public MergeMaturityResponse? MergeMaturity { get => this.Tag == Command_1Tag.MergeMaturity ? (MergeMaturityResponse)this.Value! : default; set => (this.Tag, this.Value) = (Command_1Tag.MergeMaturity, value); } + + public DisburseResponse? Disburse { get => this.Tag == Command_1Tag.Disburse ? (DisburseResponse)this.Value! : default; set => (this.Tag, this.Value) = (Command_1Tag.Disburse, value); } + + public Command_1(Command_1Tag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected Command_1() + { + } + + public class FollowInfo + { + public FollowInfo() + { + } + } + + public class ConfigureInfo + { + public ConfigureInfo() + { + } + } + + public class RegisterVoteInfo + { + public RegisterVoteInfo() + { + } + } + + public class MergeInfo + { + public MergeInfo() + { + } + } + } + + public enum Command_1Tag + { + Error, + Spawn, + Split, + Follow, + ClaimOrRefresh, + Configure, + RegisterVote, + Merge, + DisburseToNeuron, + MakeProposal, + MergeMaturity, + Disburse + } +} + +Type File: 'Command_2' + +using EdjCase.ICP.Candid.Mapping; +using Test; + +namespace Test +{ + [Variant()] + public class Command_2 + { + [VariantTagProperty()] + public Command_2Tag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public Spawn? Spawn { get => this.Tag == Command_2Tag.Spawn ? (Spawn)this.Value! : default; set => (this.Tag, this.Value) = (Command_2Tag.Spawn, value); } + + public Split? Split { get => this.Tag == Command_2Tag.Split ? (Split)this.Value! : default; set => (this.Tag, this.Value) = (Command_2Tag.Split, value); } + + public Configure? Configure { get => this.Tag == Command_2Tag.Configure ? (Configure)this.Value! : default; set => (this.Tag, this.Value) = (Command_2Tag.Configure, value); } + + public Merge? Merge { get => this.Tag == Command_2Tag.Merge ? (Merge)this.Value! : default; set => (this.Tag, this.Value) = (Command_2Tag.Merge, value); } + + public DisburseToNeuron? DisburseToNeuron { get => this.Tag == Command_2Tag.DisburseToNeuron ? (DisburseToNeuron)this.Value! : default; set => (this.Tag, this.Value) = (Command_2Tag.DisburseToNeuron, value); } + + public ClaimOrRefresh? ClaimOrRefreshNeuron { get => this.Tag == Command_2Tag.ClaimOrRefreshNeuron ? (ClaimOrRefresh)this.Value! : default; set => (this.Tag, this.Value) = (Command_2Tag.ClaimOrRefreshNeuron, value); } + + public MergeMaturity? MergeMaturity { get => this.Tag == Command_2Tag.MergeMaturity ? (MergeMaturity)this.Value! : default; set => (this.Tag, this.Value) = (Command_2Tag.MergeMaturity, value); } + + public Disburse? Disburse { get => this.Tag == Command_2Tag.Disburse ? (Disburse)this.Value! : default; set => (this.Tag, this.Value) = (Command_2Tag.Disburse, value); } + + public Command_2(Command_2Tag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected Command_2() + { + } + } + + public enum Command_2Tag + { + Spawn, + Split, + Configure, + Merge, + DisburseToNeuron, + ClaimOrRefreshNeuron, + MergeMaturity, + Disburse + } +} + +Type File: 'Configure' + +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class Configure + { + public OptionalValue operation { get; set; } + + public Configure(OptionalValue operation) + { + this.operation = operation; + } + + public Configure() + { + } + } +} + +Type File: 'Disburse' + +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class Disburse + { + public OptionalValue to_account { get; set; } + + public OptionalValue amount { get; set; } + + public Disburse(OptionalValue toAccount, OptionalValue amount) + { + this.to_account = toAccount; + this.amount = amount; + } + + public Disburse() + { + } + } +} + +Type File: 'DisburseResponse' + +namespace Test +{ + public class DisburseResponse + { + public ulong transfer_block_height { get; set; } + + public DisburseResponse(ulong transferBlockHeight) + { + this.transfer_block_height = transferBlockHeight; + } + + public DisburseResponse() + { + } + } +} + +Type File: 'DisburseToNeuron' + +using EdjCase.ICP.Candid.Models; + +namespace Test +{ + public class DisburseToNeuron + { + public ulong dissolve_delay_seconds { get; set; } + + public bool kyc_verified { get; set; } + + public ulong amount_e8s { get; set; } + + public OptionalValue new_controller { get; set; } + + public ulong nonce { get; set; } + + public DisburseToNeuron(ulong dissolveDelaySeconds, bool kycVerified, ulong amountE8s, OptionalValue newController, ulong nonce) + { + this.dissolve_delay_seconds = dissolveDelaySeconds; + this.kyc_verified = kycVerified; + this.amount_e8s = amountE8s; + this.new_controller = newController; + this.nonce = nonce; + } + + public DisburseToNeuron() + { + } + } +} + +Type File: 'DissolveState' + +using EdjCase.ICP.Candid.Mapping; +using Test; + +namespace Test +{ + [Variant()] + public class DissolveState + { + [VariantTagProperty()] + public DissolveStateTag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public ulong? DissolveDelaySeconds { get => this.Tag == DissolveStateTag.DissolveDelaySeconds ? (ulong)this.Value! : default; set => (this.Tag, this.Value) = (DissolveStateTag.DissolveDelaySeconds, value); } + + public ulong? WhenDissolvedTimestampSeconds { get => this.Tag == DissolveStateTag.WhenDissolvedTimestampSeconds ? (ulong)this.Value! : default; set => (this.Tag, this.Value) = (DissolveStateTag.WhenDissolvedTimestampSeconds, value); } + + public DissolveState(DissolveStateTag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected DissolveState() + { + } + } + + public enum DissolveStateTag + { + DissolveDelaySeconds, + WhenDissolvedTimestampSeconds + } +} + +Type File: 'ExecuteNnsFunction' + +using System.Collections.Generic; + +namespace Test +{ + public class ExecuteNnsFunction + { + public int nns_function { get; set; } + + public List payload { get; set; } + + public ExecuteNnsFunction(int nnsFunction, List payload) + { + this.nns_function = nnsFunction; + this.payload = payload; + } + + public ExecuteNnsFunction() + { + } + } +} + +Type File: 'Follow' + +using System.Collections.Generic; +using Test; + +namespace Test +{ + public class Follow + { + public int topic { get; set; } + + public List followees { get; set; } + + public Follow(int topic, List followees) + { + this.topic = topic; + this.followees = followees; + } + + public Follow() + { + } + } +} + +Type File: 'Followees' + +using System.Collections.Generic; +using Test; + +namespace Test +{ + public class Followees + { + public List followees { get; set; } + + public Followees(List followees) + { + this.followees = followees; + } + + public Followees() + { + } + } +} + +Type File: 'Governance' + +using System.Collections.Generic; +using Test; +using EdjCase.ICP.Candid.Models; + +namespace Test +{ + public class Governance + { + public Dictionary default_followees { get; set; } + + public ulong wait_for_quiet_threshold_seconds { get; set; } + + public OptionalValue metrics { get; set; } + + public List node_providers { get; set; } + + public OptionalValue economics { get; set; } + + public OptionalValue latest_reward_event { get; set; } + + public List to_claim_transfers { get; set; } + + public ulong short_voting_period_seconds { get; set; } + + public Dictionary proposals { get; set; } + + public Dictionary in_flight_commands { get; set; } + + public Dictionary neurons { get; set; } + + public ulong genesis_timestamp_seconds { get; set; } + + public Governance(Dictionary defaultFollowees, ulong waitForQuietThresholdSeconds, OptionalValue metrics, List nodeProviders, OptionalValue economics, OptionalValue latestRewardEvent, List toClaimTransfers, ulong shortVotingPeriodSeconds, Dictionary proposals, Dictionary inFlightCommands, Dictionary neurons, ulong genesisTimestampSeconds) + { + this.default_followees = defaultFollowees; + this.wait_for_quiet_threshold_seconds = waitForQuietThresholdSeconds; + this.metrics = metrics; + this.node_providers = nodeProviders; + this.economics = economics; + this.latest_reward_event = latestRewardEvent; + this.to_claim_transfers = toClaimTransfers; + this.short_voting_period_seconds = shortVotingPeriodSeconds; + this.proposals = proposals; + this.in_flight_commands = inFlightCommands; + this.neurons = neurons; + this.genesis_timestamp_seconds = genesisTimestampSeconds; + } + + public Governance() + { + } + } +} + +Type File: 'GovernanceCachedMetrics' + +using System.Collections.Generic; + +namespace Test +{ + public class GovernanceCachedMetrics + { + public Dictionary not_dissolving_neurons_e8s_buckets { get; set; } + + public ulong garbage_collectable_neurons_count { get; set; } + + public ulong neurons_with_invalid_stake_count { get; set; } + + public Dictionary not_dissolving_neurons_count_buckets { get; set; } + + public ulong total_supply_icp { get; set; } + + public ulong neurons_with_less_than_6_months_dissolve_delay_count { get; set; } + + public ulong dissolved_neurons_count { get; set; } + + public ulong total_staked_e8s { get; set; } + + public ulong not_dissolving_neurons_count { get; set; } + + public ulong dissolved_neurons_e8s { get; set; } + + public ulong neurons_with_less_than_6_months_dissolve_delay_e8s { get; set; } + + public Dictionary dissolving_neurons_count_buckets { get; set; } + + public ulong dissolving_neurons_count { get; set; } + + public Dictionary dissolving_neurons_e8s_buckets { get; set; } + + public ulong community_fund_total_staked_e8s { get; set; } + + public ulong timestamp_seconds { get; set; } + + public GovernanceCachedMetrics(Dictionary notDissolvingNeuronsE8sBuckets, ulong garbageCollectableNeuronsCount, ulong neuronsWithInvalidStakeCount, Dictionary notDissolvingNeuronsCountBuckets, ulong totalSupplyIcp, ulong neuronsWithLessThan6MonthsDissolveDelayCount, ulong dissolvedNeuronsCount, ulong totalStakedE8s, ulong notDissolvingNeuronsCount, ulong dissolvedNeuronsE8s, ulong neuronsWithLessThan6MonthsDissolveDelayE8s, Dictionary dissolvingNeuronsCountBuckets, ulong dissolvingNeuronsCount, Dictionary dissolvingNeuronsE8sBuckets, ulong communityFundTotalStakedE8s, ulong timestampSeconds) + { + this.not_dissolving_neurons_e8s_buckets = notDissolvingNeuronsE8sBuckets; + this.garbage_collectable_neurons_count = garbageCollectableNeuronsCount; + this.neurons_with_invalid_stake_count = neuronsWithInvalidStakeCount; + this.not_dissolving_neurons_count_buckets = notDissolvingNeuronsCountBuckets; + this.total_supply_icp = totalSupplyIcp; + this.neurons_with_less_than_6_months_dissolve_delay_count = neuronsWithLessThan6MonthsDissolveDelayCount; + this.dissolved_neurons_count = dissolvedNeuronsCount; + this.total_staked_e8s = totalStakedE8s; + this.not_dissolving_neurons_count = notDissolvingNeuronsCount; + this.dissolved_neurons_e8s = dissolvedNeuronsE8s; + this.neurons_with_less_than_6_months_dissolve_delay_e8s = neuronsWithLessThan6MonthsDissolveDelayE8s; + this.dissolving_neurons_count_buckets = dissolvingNeuronsCountBuckets; + this.dissolving_neurons_count = dissolvingNeuronsCount; + this.dissolving_neurons_e8s_buckets = dissolvingNeuronsE8sBuckets; + this.community_fund_total_staked_e8s = communityFundTotalStakedE8s; + this.timestamp_seconds = timestampSeconds; + } + + public GovernanceCachedMetrics() + { + } + } +} + +Type File: 'GovernanceError' + +namespace Test +{ + public class GovernanceError + { + public string error_message { get; set; } + + public int error_type { get; set; } + + public GovernanceError(string errorMessage, int errorType) + { + this.error_message = errorMessage; + this.error_type = errorType; + } + + public GovernanceError() + { + } + } +} + +Type File: 'IncreaseDissolveDelay' + +namespace Test +{ + public class IncreaseDissolveDelay + { + public uint additional_dissolve_delay_seconds { get; set; } + + public IncreaseDissolveDelay(uint additionalDissolveDelaySeconds) + { + this.additional_dissolve_delay_seconds = additionalDissolveDelaySeconds; + } + + public IncreaseDissolveDelay() + { + } + } +} + +Type File: 'KnownNeuron' + +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class KnownNeuron + { + public OptionalValue id { get; set; } + + public OptionalValue known_neuron_data { get; set; } + + public KnownNeuron(OptionalValue id, OptionalValue knownNeuronData) + { + this.id = id; + this.known_neuron_data = knownNeuronData; + } + + public KnownNeuron() + { + } + } +} + +Type File: 'KnownNeuronData' + +using EdjCase.ICP.Candid.Models; + +namespace Test +{ + public class KnownNeuronData + { + public string name { get; set; } + + public OptionalValue description { get; set; } + + public KnownNeuronData(string name, OptionalValue description) + { + this.name = name; + this.description = description; + } + + public KnownNeuronData() + { + } + } +} + +Type File: 'ListKnownNeuronsResponse' + +using System.Collections.Generic; +using Test; + +namespace Test +{ + public class ListKnownNeuronsResponse + { + public List known_neurons { get; set; } + + public ListKnownNeuronsResponse(List knownNeurons) + { + this.known_neurons = knownNeurons; + } + + public ListKnownNeuronsResponse() + { + } + } +} + +Type File: 'ListNeurons' + +using System.Collections.Generic; + +namespace Test +{ + public class ListNeurons + { + public List neuron_ids { get; set; } + + public bool include_neurons_readable_by_caller { get; set; } + + public ListNeurons(List neuronIds, bool includeNeuronsReadableByCaller) + { + this.neuron_ids = neuronIds; + this.include_neurons_readable_by_caller = includeNeuronsReadableByCaller; + } + + public ListNeurons() + { + } + } +} + +Type File: 'ListNeuronsResponse' + +using System.Collections.Generic; +using Test; + +namespace Test +{ + public class ListNeuronsResponse + { + public Dictionary neuron_infos { get; set; } + + public List full_neurons { get; set; } + + public ListNeuronsResponse(Dictionary neuronInfos, List fullNeurons) + { + this.neuron_infos = neuronInfos; + this.full_neurons = fullNeurons; + } + + public ListNeuronsResponse() + { + } + } +} + +Type File: 'ListNodeProvidersResponse' + +using System.Collections.Generic; +using Test; + +namespace Test +{ + public class ListNodeProvidersResponse + { + public List node_providers { get; set; } + + public ListNodeProvidersResponse(List nodeProviders) + { + this.node_providers = nodeProviders; + } + + public ListNodeProvidersResponse() + { + } + } +} + +Type File: 'ListProposalInfo' + +using System.Collections.Generic; +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class ListProposalInfo + { + public List include_reward_status { get; set; } + + public OptionalValue before_proposal { get; set; } + + public uint limit { get; set; } + + public List exclude_topic { get; set; } + + public List include_status { get; set; } + + public ListProposalInfo(List includeRewardStatus, OptionalValue beforeProposal, uint limit, List excludeTopic, List includeStatus) + { + this.include_reward_status = includeRewardStatus; + this.before_proposal = beforeProposal; + this.limit = limit; + this.exclude_topic = excludeTopic; + this.include_status = includeStatus; + } + + public ListProposalInfo() + { + } + } +} + +Type File: 'ListProposalInfoResponse' + +using System.Collections.Generic; +using Test; + +namespace Test +{ + public class ListProposalInfoResponse + { + public List proposal_info { get; set; } + + public ListProposalInfoResponse(List proposalInfo) + { + this.proposal_info = proposalInfo; + } + + public ListProposalInfoResponse() + { + } + } +} + +Type File: 'MakeProposalResponse' + +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class MakeProposalResponse + { + public OptionalValue proposal_id { get; set; } + + public MakeProposalResponse(OptionalValue proposalId) + { + this.proposal_id = proposalId; + } + + public MakeProposalResponse() + { + } + } +} + +Type File: 'ManageNeuron' + +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class ManageNeuron + { + public OptionalValue id { get; set; } + + public OptionalValue command { get; set; } + + public OptionalValue neuron_id_or_subaccount { get; set; } + + public ManageNeuron(OptionalValue id, OptionalValue command, OptionalValue neuronIdOrSubaccount) + { + this.id = id; + this.command = command; + this.neuron_id_or_subaccount = neuronIdOrSubaccount; + } + + public ManageNeuron() + { + } + } +} + +Type File: 'ManageNeuronResponse' + +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class ManageNeuronResponse + { + public OptionalValue command { get; set; } + + public ManageNeuronResponse(OptionalValue command) + { + this.command = command; + } + + public ManageNeuronResponse() + { + } + } +} + +Type File: 'Merge' + +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class Merge + { + public OptionalValue source_neuron_id { get; set; } + + public Merge(OptionalValue sourceNeuronId) + { + this.source_neuron_id = sourceNeuronId; + } + + public Merge() + { + } + } +} + +Type File: 'MergeMaturity' + +namespace Test +{ + public class MergeMaturity + { + public uint percentage_to_merge { get; set; } + + public MergeMaturity(uint percentageToMerge) + { + this.percentage_to_merge = percentageToMerge; + } + + public MergeMaturity() + { + } + } +} + +Type File: 'MergeMaturityResponse' + +namespace Test +{ + public class MergeMaturityResponse + { + public ulong merged_maturity_e8s { get; set; } + + public ulong new_stake_e8s { get; set; } + + public MergeMaturityResponse(ulong mergedMaturityE8s, ulong newStakeE8s) + { + this.merged_maturity_e8s = mergedMaturityE8s; + this.new_stake_e8s = newStakeE8s; + } + + public MergeMaturityResponse() + { + } + } +} + +Type File: 'Motion' + +namespace Test +{ + public class Motion + { + public string motion_text { get; set; } + + public Motion(string motionText) + { + this.motion_text = motionText; + } + + public Motion() + { + } + } +} + +Type File: 'NetworkEconomics' + +namespace Test +{ + public class NetworkEconomics + { + public ulong neuron_minimum_stake_e8s { get; set; } + + public uint max_proposals_to_keep_per_topic { get; set; } + + public ulong neuron_management_fee_per_proposal_e8s { get; set; } + + public ulong reject_cost_e8s { get; set; } + + public ulong transaction_fee_e8s { get; set; } + + public ulong neuron_spawn_dissolve_delay_seconds { get; set; } + + public ulong minimum_icp_xdr_rate { get; set; } + + public ulong maximum_node_provider_rewards_e8s { get; set; } + + public NetworkEconomics(ulong neuronMinimumStakeE8s, uint maxProposalsToKeepPerTopic, ulong neuronManagementFeePerProposalE8s, ulong rejectCostE8s, ulong transactionFeeE8s, ulong neuronSpawnDissolveDelaySeconds, ulong minimumIcpXdrRate, ulong maximumNodeProviderRewardsE8s) + { + this.neuron_minimum_stake_e8s = neuronMinimumStakeE8s; + this.max_proposals_to_keep_per_topic = maxProposalsToKeepPerTopic; + this.neuron_management_fee_per_proposal_e8s = neuronManagementFeePerProposalE8s; + this.reject_cost_e8s = rejectCostE8s; + this.transaction_fee_e8s = transactionFeeE8s; + this.neuron_spawn_dissolve_delay_seconds = neuronSpawnDissolveDelaySeconds; + this.minimum_icp_xdr_rate = minimumIcpXdrRate; + this.maximum_node_provider_rewards_e8s = maximumNodeProviderRewardsE8s; + } + + public NetworkEconomics() + { + } + } +} + +Type File: 'Neuron' + +using EdjCase.ICP.Candid.Models; +using Test; +using System.Collections.Generic; + +namespace Test +{ + public class Neuron + { + public OptionalValue id { get; set; } + + public OptionalValue controller { get; set; } + + public List recent_ballots { get; set; } + + public bool kyc_verified { get; set; } + + public bool not_for_profit { get; set; } + + public ulong maturity_e8s_equivalent { get; set; } + + public ulong cached_neuron_stake_e8s { get; set; } + + public ulong created_timestamp_seconds { get; set; } + + public ulong aging_since_timestamp_seconds { get; set; } + + public List hot_keys { get; set; } + + public List account { get; set; } + + public OptionalValue joined_community_fund_timestamp_seconds { get; set; } + + public OptionalValue dissolve_state { get; set; } + + public Dictionary followees { get; set; } + + public ulong neuron_fees_e8s { get; set; } + + public OptionalValue transfer { get; set; } + + public OptionalValue known_neuron_data { get; set; } + + public Neuron(OptionalValue id, OptionalValue controller, List recentBallots, bool kycVerified, bool notForProfit, ulong maturityE8sEquivalent, ulong cachedNeuronStakeE8s, ulong createdTimestampSeconds, ulong agingSinceTimestampSeconds, List hotKeys, List account, OptionalValue joinedCommunityFundTimestampSeconds, OptionalValue dissolveState, Dictionary followees, ulong neuronFeesE8s, OptionalValue transfer, OptionalValue knownNeuronData) + { + this.id = id; + this.controller = controller; + this.recent_ballots = recentBallots; + this.kyc_verified = kycVerified; + this.not_for_profit = notForProfit; + this.maturity_e8s_equivalent = maturityE8sEquivalent; + this.cached_neuron_stake_e8s = cachedNeuronStakeE8s; + this.created_timestamp_seconds = createdTimestampSeconds; + this.aging_since_timestamp_seconds = agingSinceTimestampSeconds; + this.hot_keys = hotKeys; + this.account = account; + this.joined_community_fund_timestamp_seconds = joinedCommunityFundTimestampSeconds; + this.dissolve_state = dissolveState; + this.followees = followees; + this.neuron_fees_e8s = neuronFeesE8s; + this.transfer = transfer; + this.known_neuron_data = knownNeuronData; + } + + public Neuron() + { + } + } +} + +Type File: 'NeuronId' + +namespace Test +{ + public class NeuronId + { + public ulong id { get; set; } + + public NeuronId(ulong id) + { + this.id = id; + } + + public NeuronId() + { + } + } +} + +Type File: 'NeuronIdOrSubaccount' + +using EdjCase.ICP.Candid.Mapping; +using Test; +using System.Collections.Generic; + +namespace Test +{ + [Variant()] + public class NeuronIdOrSubaccount + { + [VariantTagProperty()] + public NeuronIdOrSubaccountTag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public List? Subaccount { get => this.Tag == NeuronIdOrSubaccountTag.Subaccount ? (List)this.Value! : default; set => (this.Tag, this.Value) = (NeuronIdOrSubaccountTag.Subaccount, value); } + + public NeuronId? NeuronId { get => this.Tag == NeuronIdOrSubaccountTag.NeuronId ? (NeuronId)this.Value! : default; set => (this.Tag, this.Value) = (NeuronIdOrSubaccountTag.NeuronId, value); } + + public NeuronIdOrSubaccount(NeuronIdOrSubaccountTag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected NeuronIdOrSubaccount() + { + } + } + + public enum NeuronIdOrSubaccountTag + { + Subaccount, + NeuronId + } +} + +Type File: 'NeuronInFlightCommand' + +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class NeuronInFlightCommand + { + public OptionalValue command { get; set; } + + public ulong timestamp { get; set; } + + public NeuronInFlightCommand(OptionalValue command, ulong timestamp) + { + this.command = command; + this.timestamp = timestamp; + } + + public NeuronInFlightCommand() + { + } + } +} + +Type File: 'NeuronInfo' + +using System.Collections.Generic; +using Test; +using EdjCase.ICP.Candid.Models; + +namespace Test +{ + public class NeuronInfo + { + public ulong dissolve_delay_seconds { get; set; } + + public List recent_ballots { get; set; } + + public ulong created_timestamp_seconds { get; set; } + + public int state { get; set; } + + public ulong stake_e8s { get; set; } + + public OptionalValue joined_community_fund_timestamp_seconds { get; set; } + + public ulong retrieved_at_timestamp_seconds { get; set; } + + public OptionalValue known_neuron_data { get; set; } + + public ulong voting_power { get; set; } + + public ulong age_seconds { get; set; } + + public NeuronInfo(ulong dissolveDelaySeconds, List recentBallots, ulong createdTimestampSeconds, int state, ulong stakeE8s, OptionalValue joinedCommunityFundTimestampSeconds, ulong retrievedAtTimestampSeconds, OptionalValue knownNeuronData, ulong votingPower, ulong ageSeconds) + { + this.dissolve_delay_seconds = dissolveDelaySeconds; + this.recent_ballots = recentBallots; + this.created_timestamp_seconds = createdTimestampSeconds; + this.state = state; + this.stake_e8s = stakeE8s; + this.joined_community_fund_timestamp_seconds = joinedCommunityFundTimestampSeconds; + this.retrieved_at_timestamp_seconds = retrievedAtTimestampSeconds; + this.known_neuron_data = knownNeuronData; + this.voting_power = votingPower; + this.age_seconds = ageSeconds; + } + + public NeuronInfo() + { + } + } +} + +Type File: 'NeuronStakeTransfer' + +using System.Collections.Generic; +using EdjCase.ICP.Candid.Models; + +namespace Test +{ + public class NeuronStakeTransfer + { + public List to_subaccount { get; set; } + + public ulong neuron_stake_e8s { get; set; } + + public OptionalValue from { get; set; } + + public ulong memo { get; set; } + + public List from_subaccount { get; set; } + + public ulong transfer_timestamp { get; set; } + + public ulong block_height { get; set; } + + public NeuronStakeTransfer(List toSubaccount, ulong neuronStakeE8s, OptionalValue from, ulong memo, List fromSubaccount, ulong transferTimestamp, ulong blockHeight) + { + this.to_subaccount = toSubaccount; + this.neuron_stake_e8s = neuronStakeE8s; + this.from = from; + this.memo = memo; + this.from_subaccount = fromSubaccount; + this.transfer_timestamp = transferTimestamp; + this.block_height = blockHeight; + } + + public NeuronStakeTransfer() + { + } + } +} + +Type File: 'NodeProvider' + +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class NodeProvider + { + public OptionalValue id { get; set; } + + public OptionalValue reward_account { get; set; } + + public NodeProvider(OptionalValue id, OptionalValue rewardAccount) + { + this.id = id; + this.reward_account = rewardAccount; + } + + public NodeProvider() + { + } + } +} + +Type File: 'Operation' + +using EdjCase.ICP.Candid.Mapping; +using Test; + +namespace Test +{ + [Variant()] + public class Operation + { + [VariantTagProperty()] + public OperationTag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public RemoveHotKey? RemoveHotKey { get => this.Tag == OperationTag.RemoveHotKey ? (RemoveHotKey)this.Value! : default; set => (this.Tag, this.Value) = (OperationTag.RemoveHotKey, value); } + + public AddHotKey? AddHotKey { get => this.Tag == OperationTag.AddHotKey ? (AddHotKey)this.Value! : default; set => (this.Tag, this.Value) = (OperationTag.AddHotKey, value); } + + public Operation.StopDissolvingInfo? StopDissolving { get => this.Tag == OperationTag.StopDissolving ? (Operation.StopDissolvingInfo)this.Value! : default; set => (this.Tag, this.Value) = (OperationTag.StopDissolving, value); } + + public Operation.StartDissolvingInfo? StartDissolving { get => this.Tag == OperationTag.StartDissolving ? (Operation.StartDissolvingInfo)this.Value! : default; set => (this.Tag, this.Value) = (OperationTag.StartDissolving, value); } + + public IncreaseDissolveDelay? IncreaseDissolveDelay { get => this.Tag == OperationTag.IncreaseDissolveDelay ? (IncreaseDissolveDelay)this.Value! : default; set => (this.Tag, this.Value) = (OperationTag.IncreaseDissolveDelay, value); } + + public Operation.JoinCommunityFundInfo? JoinCommunityFund { get => this.Tag == OperationTag.JoinCommunityFund ? (Operation.JoinCommunityFundInfo)this.Value! : default; set => (this.Tag, this.Value) = (OperationTag.JoinCommunityFund, value); } + + public SetDissolveTimestamp? SetDissolveTimestamp { get => this.Tag == OperationTag.SetDissolveTimestamp ? (SetDissolveTimestamp)this.Value! : default; set => (this.Tag, this.Value) = (OperationTag.SetDissolveTimestamp, value); } + + public Operation(OperationTag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected Operation() + { + } + + public class StopDissolvingInfo + { + public StopDissolvingInfo() + { + } + } + + public class StartDissolvingInfo + { + public StartDissolvingInfo() + { + } + } + + public class JoinCommunityFundInfo + { + public JoinCommunityFundInfo() + { + } + } + } + + public enum OperationTag + { + RemoveHotKey, + AddHotKey, + StopDissolving, + StartDissolving, + IncreaseDissolveDelay, + JoinCommunityFund, + SetDissolveTimestamp + } +} + +Type File: 'Proposal' + +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class Proposal + { + public string url { get; set; } + + public OptionalValue title { get; set; } + + public OptionalValue action { get; set; } + + public string summary { get; set; } + + public Proposal(string url, OptionalValue title, OptionalValue action, string summary) + { + this.url = url; + this.title = title; + this.action = action; + this.summary = summary; + } + + public Proposal() + { + } + } +} + +Type File: 'ProposalData' + +using EdjCase.ICP.Candid.Models; +using Test; +using System.Collections.Generic; + +namespace Test +{ + public class ProposalData + { + public OptionalValue id { get; set; } + + public OptionalValue failure_reason { get; set; } + + public Dictionary ballots { get; set; } + + public ulong proposal_timestamp_seconds { get; set; } + + public ulong reward_event_round { get; set; } + + public ulong failed_timestamp_seconds { get; set; } + + public ulong reject_cost_e8s { get; set; } + + public OptionalValue latest_tally { get; set; } + + public ulong decided_timestamp_seconds { get; set; } + + public OptionalValue proposal { get; set; } + + public OptionalValue proposer { get; set; } + + public OptionalValue wait_for_quiet_state { get; set; } + + public ulong executed_timestamp_seconds { get; set; } + + public ProposalData(OptionalValue id, OptionalValue failureReason, Dictionary ballots, ulong proposalTimestampSeconds, ulong rewardEventRound, ulong failedTimestampSeconds, ulong rejectCostE8s, OptionalValue latestTally, ulong decidedTimestampSeconds, OptionalValue proposal, OptionalValue proposer, OptionalValue waitForQuietState, ulong executedTimestampSeconds) + { + this.id = id; + this.failure_reason = failureReason; + this.ballots = ballots; + this.proposal_timestamp_seconds = proposalTimestampSeconds; + this.reward_event_round = rewardEventRound; + this.failed_timestamp_seconds = failedTimestampSeconds; + this.reject_cost_e8s = rejectCostE8s; + this.latest_tally = latestTally; + this.decided_timestamp_seconds = decidedTimestampSeconds; + this.proposal = proposal; + this.proposer = proposer; + this.wait_for_quiet_state = waitForQuietState; + this.executed_timestamp_seconds = executedTimestampSeconds; + } + + public ProposalData() + { + } + } +} + +Type File: 'ProposalInfo' + +using EdjCase.ICP.Candid.Models; +using Test; +using System.Collections.Generic; + +namespace Test +{ + public class ProposalInfo + { + public OptionalValue id { get; set; } + + public int status { get; set; } + + public int topic { get; set; } + + public OptionalValue failure_reason { get; set; } + + public Dictionary ballots { get; set; } + + public ulong proposal_timestamp_seconds { get; set; } + + public ulong reward_event_round { get; set; } + + public OptionalValue deadline_timestamp_seconds { get; set; } + + public ulong failed_timestamp_seconds { get; set; } + + public ulong reject_cost_e8s { get; set; } + + public OptionalValue latest_tally { get; set; } + + public int reward_status { get; set; } + + public ulong decided_timestamp_seconds { get; set; } + + public OptionalValue proposal { get; set; } + + public OptionalValue proposer { get; set; } + + public ulong executed_timestamp_seconds { get; set; } + + public ProposalInfo(OptionalValue id, int status, int topic, OptionalValue failureReason, Dictionary ballots, ulong proposalTimestampSeconds, ulong rewardEventRound, OptionalValue deadlineTimestampSeconds, ulong failedTimestampSeconds, ulong rejectCostE8s, OptionalValue latestTally, int rewardStatus, ulong decidedTimestampSeconds, OptionalValue proposal, OptionalValue proposer, ulong executedTimestampSeconds) + { + this.id = id; + this.status = status; + this.topic = topic; + this.failure_reason = failureReason; + this.ballots = ballots; + this.proposal_timestamp_seconds = proposalTimestampSeconds; + this.reward_event_round = rewardEventRound; + this.deadline_timestamp_seconds = deadlineTimestampSeconds; + this.failed_timestamp_seconds = failedTimestampSeconds; + this.reject_cost_e8s = rejectCostE8s; + this.latest_tally = latestTally; + this.reward_status = rewardStatus; + this.decided_timestamp_seconds = decidedTimestampSeconds; + this.proposal = proposal; + this.proposer = proposer; + this.executed_timestamp_seconds = executedTimestampSeconds; + } + + public ProposalInfo() + { + } + } +} + +Type File: 'RegisterVote' + +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class RegisterVote + { + public int vote { get; set; } + + public OptionalValue proposal { get; set; } + + public RegisterVote(int vote, OptionalValue proposal) + { + this.vote = vote; + this.proposal = proposal; + } + + public RegisterVote() + { + } + } +} + +Type File: 'RemoveHotKey' + +using EdjCase.ICP.Candid.Models; + +namespace Test +{ + public class RemoveHotKey + { + public OptionalValue hot_key_to_remove { get; set; } + + public RemoveHotKey(OptionalValue hotKeyToRemove) + { + this.hot_key_to_remove = hotKeyToRemove; + } + + public RemoveHotKey() + { + } + } +} + +Type File: 'Result' + +using EdjCase.ICP.Candid.Mapping; +using Test; + +namespace Test +{ + [Variant()] + public class Result + { + [VariantTagProperty()] + public ResultTag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public GovernanceError? Err { get => this.Tag == ResultTag.Err ? (GovernanceError)this.Value! : default; set => (this.Tag, this.Value) = (ResultTag.Err, value); } + + public Result(ResultTag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected Result() + { + } + } + + public enum ResultTag + { + Ok, + Err + } +} + +Type File: 'Result_1' + +using EdjCase.ICP.Candid.Mapping; +using Test; + +namespace Test +{ + [Variant()] + public class Result_1 + { + [VariantTagProperty()] + public Result_1Tag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public GovernanceError? Error { get => this.Tag == Result_1Tag.Error ? (GovernanceError)this.Value! : default; set => (this.Tag, this.Value) = (Result_1Tag.Error, value); } + + public NeuronId? NeuronId { get => this.Tag == Result_1Tag.NeuronId ? (NeuronId)this.Value! : default; set => (this.Tag, this.Value) = (Result_1Tag.NeuronId, value); } + + public Result_1(Result_1Tag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected Result_1() + { + } + } + + public enum Result_1Tag + { + Error, + NeuronId + } +} + +Type File: 'Result_2' + +using EdjCase.ICP.Candid.Mapping; +using Test; + +namespace Test +{ + [Variant()] + public class Result_2 + { + [VariantTagProperty()] + public Result_2Tag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public Neuron? Ok { get => this.Tag == Result_2Tag.Ok ? (Neuron)this.Value! : default; set => (this.Tag, this.Value) = (Result_2Tag.Ok, value); } + + public GovernanceError? Err { get => this.Tag == Result_2Tag.Err ? (GovernanceError)this.Value! : default; set => (this.Tag, this.Value) = (Result_2Tag.Err, value); } + + public Result_2(Result_2Tag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected Result_2() + { + } + } + + public enum Result_2Tag + { + Ok, + Err + } +} + +Type File: 'Result_3' + +using EdjCase.ICP.Candid.Mapping; +using Test; + +namespace Test +{ + [Variant()] + public class Result_3 + { + [VariantTagProperty()] + public Result_3Tag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public RewardNodeProviders? Ok { get => this.Tag == Result_3Tag.Ok ? (RewardNodeProviders)this.Value! : default; set => (this.Tag, this.Value) = (Result_3Tag.Ok, value); } + + public GovernanceError? Err { get => this.Tag == Result_3Tag.Err ? (GovernanceError)this.Value! : default; set => (this.Tag, this.Value) = (Result_3Tag.Err, value); } + + public Result_3(Result_3Tag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected Result_3() + { + } + } + + public enum Result_3Tag + { + Ok, + Err + } +} + +Type File: 'Result_4' + +using EdjCase.ICP.Candid.Mapping; +using Test; + +namespace Test +{ + [Variant()] + public class Result_4 + { + [VariantTagProperty()] + public Result_4Tag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public NeuronInfo? Ok { get => this.Tag == Result_4Tag.Ok ? (NeuronInfo)this.Value! : default; set => (this.Tag, this.Value) = (Result_4Tag.Ok, value); } + + public GovernanceError? Err { get => this.Tag == Result_4Tag.Err ? (GovernanceError)this.Value! : default; set => (this.Tag, this.Value) = (Result_4Tag.Err, value); } + + public Result_4(Result_4Tag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected Result_4() + { + } + } + + public enum Result_4Tag + { + Ok, + Err + } +} + +Type File: 'Result_5' + +using EdjCase.ICP.Candid.Mapping; +using Test; + +namespace Test +{ + [Variant()] + public class Result_5 + { + [VariantTagProperty()] + public Result_5Tag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public NodeProvider? Ok { get => this.Tag == Result_5Tag.Ok ? (NodeProvider)this.Value! : default; set => (this.Tag, this.Value) = (Result_5Tag.Ok, value); } + + public GovernanceError? Err { get => this.Tag == Result_5Tag.Err ? (GovernanceError)this.Value! : default; set => (this.Tag, this.Value) = (Result_5Tag.Err, value); } + + public Result_5(Result_5Tag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected Result_5() + { + } + } + + public enum Result_5Tag + { + Ok, + Err + } +} + +Type File: 'RewardEvent' + +using System.Collections.Generic; +using Test; + +namespace Test +{ + public class RewardEvent + { + public ulong day_after_genesis { get; set; } + + public ulong actual_timestamp_seconds { get; set; } + + public ulong distributed_e8s_equivalent { get; set; } + + public List settled_proposals { get; set; } + + public RewardEvent(ulong dayAfterGenesis, ulong actualTimestampSeconds, ulong distributedE8sEquivalent, List settledProposals) + { + this.day_after_genesis = dayAfterGenesis; + this.actual_timestamp_seconds = actualTimestampSeconds; + this.distributed_e8s_equivalent = distributedE8sEquivalent; + this.settled_proposals = settledProposals; + } + + public RewardEvent() + { + } + } +} + +Type File: 'RewardMode' + +using EdjCase.ICP.Candid.Mapping; +using Test; + +namespace Test +{ + [Variant()] + public class RewardMode + { + [VariantTagProperty()] + public RewardModeTag Tag { get; set; } + + [VariantValueProperty()] + public object? Value { get; set; } + + public RewardToNeuron? RewardToNeuron { get => this.Tag == RewardModeTag.RewardToNeuron ? (RewardToNeuron)this.Value! : default; set => (this.Tag, this.Value) = (RewardModeTag.RewardToNeuron, value); } + + public RewardToAccount? RewardToAccount { get => this.Tag == RewardModeTag.RewardToAccount ? (RewardToAccount)this.Value! : default; set => (this.Tag, this.Value) = (RewardModeTag.RewardToAccount, value); } + + public RewardMode(RewardModeTag tag, object? value) + { + this.Tag = tag; + this.Value = value; + } + + protected RewardMode() + { + } + } + + public enum RewardModeTag + { + RewardToNeuron, + RewardToAccount + } +} + +Type File: 'RewardNodeProvider' + +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class RewardNodeProvider + { + public OptionalValue node_provider { get; set; } + + public OptionalValue reward_mode { get; set; } + + public ulong amount_e8s { get; set; } + + public RewardNodeProvider(OptionalValue nodeProvider, OptionalValue rewardMode, ulong amountE8s) + { + this.node_provider = nodeProvider; + this.reward_mode = rewardMode; + this.amount_e8s = amountE8s; + } + + public RewardNodeProvider() + { + } + } +} + +Type File: 'RewardNodeProviders' + +using EdjCase.ICP.Candid.Models; +using System.Collections.Generic; +using Test; + +namespace Test +{ + public class RewardNodeProviders + { + public OptionalValue use_registry_derived_rewards { get; set; } + + public List rewards { get; set; } + + public RewardNodeProviders(OptionalValue useRegistryDerivedRewards, List rewards) + { + this.use_registry_derived_rewards = useRegistryDerivedRewards; + this.rewards = rewards; + } + + public RewardNodeProviders() + { + } + } +} + +Type File: 'RewardToAccount' + +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class RewardToAccount + { + public OptionalValue to_account { get; set; } + + public RewardToAccount(OptionalValue toAccount) + { + this.to_account = toAccount; + } + + public RewardToAccount() + { + } + } +} + +Type File: 'RewardToNeuron' + +namespace Test +{ + public class RewardToNeuron + { + public ulong dissolve_delay_seconds { get; set; } + + public RewardToNeuron(ulong dissolveDelaySeconds) + { + this.dissolve_delay_seconds = dissolveDelaySeconds; + } + + public RewardToNeuron() + { + } + } +} + +Type File: 'SetDefaultFollowees' + +using System.Collections.Generic; +using Test; + +namespace Test +{ + public class SetDefaultFollowees + { + public Dictionary default_followees { get; set; } + + public SetDefaultFollowees(Dictionary defaultFollowees) + { + this.default_followees = defaultFollowees; + } + + public SetDefaultFollowees() + { + } + } +} + +Type File: 'SetDissolveTimestamp' + +namespace Test +{ + public class SetDissolveTimestamp + { + public ulong dissolve_timestamp_seconds { get; set; } + + public SetDissolveTimestamp(ulong dissolveTimestampSeconds) + { + this.dissolve_timestamp_seconds = dissolveTimestampSeconds; + } + + public SetDissolveTimestamp() + { + } + } +} + +Type File: 'Spawn' + +using EdjCase.ICP.Candid.Models; + +namespace Test +{ + public class Spawn + { + public OptionalValue percentage_to_spawn { get; set; } + + public OptionalValue new_controller { get; set; } + + public OptionalValue nonce { get; set; } + + public Spawn(OptionalValue percentageToSpawn, OptionalValue newController, OptionalValue nonce) + { + this.percentage_to_spawn = percentageToSpawn; + this.new_controller = newController; + this.nonce = nonce; + } + + public Spawn() + { + } + } +} + +Type File: 'SpawnResponse' + +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class SpawnResponse + { + public OptionalValue created_neuron_id { get; set; } + + public SpawnResponse(OptionalValue createdNeuronId) + { + this.created_neuron_id = createdNeuronId; + } + + public SpawnResponse() + { + } + } +} + +Type File: 'Split' + +namespace Test +{ + public class Split + { + public ulong amount_e8s { get; set; } + + public Split(ulong amountE8s) + { + this.amount_e8s = amountE8s; + } + + public Split() + { + } + } +} + +Type File: 'Tally' + +namespace Test +{ + public class Tally + { + public ulong no { get; set; } + + public ulong yes { get; set; } + + public ulong total { get; set; } + + public ulong timestamp_seconds { get; set; } + + public Tally(ulong no, ulong yes, ulong total, ulong timestampSeconds) + { + this.no = no; + this.yes = yes; + this.total = total; + this.timestamp_seconds = timestampSeconds; + } + + public Tally() + { + } + } +} + +Type File: 'UpdateNodeProvider' + +using EdjCase.ICP.Candid.Models; +using Test; + +namespace Test +{ + public class UpdateNodeProvider + { + public OptionalValue reward_account { get; set; } + + public UpdateNodeProvider(OptionalValue rewardAccount) + { + this.reward_account = rewardAccount; + } + + public UpdateNodeProvider() + { + } + } +} + +Type File: 'WaitForQuietState' + +namespace Test +{ + public class WaitForQuietState + { + public ulong current_deadline_timestamp_seconds { get; set; } + + public WaitForQuietState(ulong currentDeadlineTimestampSeconds) + { + this.current_deadline_timestamp_seconds = currentDeadlineTimestampSeconds; + } + + public WaitForQuietState() + { + } + } +}