Skip to content

Commit

Permalink
Missing account checks on client creation. (#19)
Browse files Browse the repository at this point in the history
  • Loading branch information
tiago18c authored Jun 14, 2022
1 parent d9ef365 commit 558d103
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion SharedBuildProperties.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Product>Solnet</Product>
<Version>0.2.6</Version>
<Version>0.2.7</Version>
<Copyright>Copyright 2022 &#169; Solnet</Copyright>
<Authors>blockmountain</Authors>
<PublisherName>blockmountain</PublisherName>
Expand Down
18 changes: 10 additions & 8 deletions Solnet.Anchor/ClientGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,15 @@ public SyntaxTree GenerateSyntaxTree(Idl idl)
{
List<MemberDeclarationSyntax> members = new();

if (idl.Accounts != null && idl.Accounts.Length > 0)
if (idl.Accounts is { Length: > 0 })
members.Add(GenerateAccountsSyntaxTree(idl));

members.Add(GenerateErrorsSyntaxTree(idl));

if (idl.Events != null && idl.Events.Length > 0)
if (idl.Events is { Length: > 0 })
members.Add(GenerateEventsSyntaxTree(idl));

if (idl.Types != null && idl.Types.Length > 0)
if (idl.Types is { Length: > 0 })
members.Add(GenerateTypesSyntaxTree(idl));

members.Add(GenerateClientSyntaxTree(idl));
Expand Down Expand Up @@ -898,12 +898,14 @@ private MemberDeclarationSyntax GenerateClientSyntaxTree(Idl idl)

var className = idl.Name.ToPascalCase() + "Client";

//clientMembers.AddRange(GenerateFields());
clientMembers.Add(GenerateConstructor(idl, className));
//clientMembers.Add(GenerateParseAccount());
clientMembers.AddRange(GenerateGetAccounts(idl));
clientMembers.AddRange(GenerateGetAccount(idl));
clientMembers.AddRange(GenerateSubscribeAccount(idl));

if (idl.Accounts is { Length: > 0 })
{
clientMembers.AddRange(GenerateGetAccounts(idl));
clientMembers.AddRange(GenerateGetAccount(idl));
clientMembers.AddRange(GenerateSubscribeAccount(idl));
}

clientMembers.AddRange(GenerateInstructionBuilderMethods(idl));

Expand Down

0 comments on commit 558d103

Please sign in to comment.