Skip to content

Commit

Permalink
feat: include program id & default addresses
Browse files Browse the repository at this point in the history
  • Loading branch information
GabrielePicco committed Dec 16, 2024
1 parent ad73b8f commit c066317
Show file tree
Hide file tree
Showing 8 changed files with 991 additions and 718 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>Solana.Unity.Anchor</Product>
<Version>0.2.14</Version>
<Version>0.2.15</Version>
<Copyright>Copyright 2023 &#169; Magicblock</Copyright>
<Authors>Magicblock</Authors>
<PublisherName>Magicblock</PublisherName>
Expand Down
2 changes: 0 additions & 2 deletions Solana.Unity.Anchor.Tool/AnchorSourceGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,6 @@ static int Main(string[] args)
return -3;
}

idl.DefaultProgramAddress = opts.Address;

ClientGenerator cg = new ClientGenerator();

var code = cg.GenerateCode(idl);
Expand Down
1,681 changes: 984 additions & 697 deletions Solana.Unity.Anchor/ClientGenerator.cs

Large diffs are not rendered by default.

4 changes: 0 additions & 4 deletions Solana.Unity.Anchor/Converters/IIdlAccountItemConverter.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
using Solana.Unity.Anchor.Models.Accounts;
using Solana.Unity.Anchor.Models.Types;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.Json;
using System.Text.Json.Serialization;
using System.Threading.Tasks;

namespace Solana.Unity.Anchor.Converters
{
Expand Down
1 change: 1 addition & 0 deletions Solana.Unity.Anchor/Models/Accounts/IdlAccounts.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ namespace Solana.Unity.Anchor.Models.Accounts
public class IdlAccounts : IIdlAccountItem
{
public string Name { get; set; }
public string Address { get; set; }

public string FullName { get; set; }

Expand Down
8 changes: 1 addition & 7 deletions Solana.Unity.Anchor/Models/Idl.cs
Original file line number Diff line number Diff line change
@@ -1,19 +1,13 @@
using Solana.Unity.Anchor.Converters;
using Solana.Unity.Anchor.Models.Types;
using Solana.Unity.Anchor.CodeGen;
using Solana.Unity.Anchor.Models.Accounts;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.Json.Serialization;
using System.Threading.Tasks;

namespace Solana.Unity.Anchor.Models
{
public class Idl
{
[JsonIgnore]
[JsonIgnore]
public string Address => DefaultProgramAddress ?? Metadata?.Address;

[JsonPropertyName("address")]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ namespace Solana.Unity.Anchor.Models.Types
public class EnumIdlTypeDefinition : IIdlTypeDefinitionTy
{
public string Name { get; set; }
public string Address { get; set; }

public bool Writable { get; set; }

public IEnumVariant[] Variants { get; set; }

Expand Down
8 changes: 1 addition & 7 deletions Solana.Unity.Anchor/Models/Types/IIdlTypeDefinitionTy.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Solana.Unity.Anchor.Models.Types
namespace Solana.Unity.Anchor.Models.Types
{
public interface IIdlTypeDefinitionTy
{
Expand Down

0 comments on commit c066317

Please sign in to comment.