Browse Source

:recycle: Updating C# client

Danilo Guanabara 2 months ago
parent
commit
196ddcc6b1

+ 2 - 0
clients/csharp/Solana.Unity.Bolt.Test/ECSTest.cs

@@ -108,9 +108,11 @@ namespace ECSTest {
 
 
         public static async Task ApplySimpleMovementSystemUpOnEntity1(Framework framework) {
         public static async Task ApplySimpleMovementSystemUpOnEntity1(Framework framework) {
             var apply = new ApplyAccounts() {
             var apply = new ApplyAccounts() {
+                CpiAuth = WorldProgram.CPI_AUTH_ADDRESS,
                 Authority = framework.Wallet.Account.PublicKey,
                 Authority = framework.Wallet.Account.PublicKey,
                 BoltSystem = framework.SystemSimpleMovement,
                 BoltSystem = framework.SystemSimpleMovement,
                 World = framework.WorldPda,
                 World = framework.WorldPda,
+                Buffer = WorldProgram.FindBufferPda(),
             };
             };
             var instruction = WorldProgram.Apply(apply, Bolt.World.SerializeArgs(new { direction = "Up" }));
             var instruction = WorldProgram.Apply(apply, Bolt.World.SerializeArgs(new { direction = "Up" }));
             instruction.Keys.Add(AccountMeta.ReadOnly(framework.ExampleComponentPosition, false));
             instruction.Keys.Add(AccountMeta.ReadOnly(framework.ExampleComponentPosition, false));

+ 2 - 1
clients/csharp/Solana.Unity.Bolt.Test/Framework.cs

@@ -96,7 +96,7 @@ namespace Solana.Unity.Bolt.Test
                 .AddInstruction(instruction)
                 .AddInstruction(instruction)
                 .Build(signers);
                 .Build(signers);
 
 
-            var signature = await client.SendTransactionAsync(transaction, true, Commitment.Processed);
+            var signature = await client.SendTransactionAsync(transaction, false, Commitment.Processed);
             var confirmed = await client.ConfirmTransaction(signature.Result, Commitment.Processed);
             var confirmed = await client.ConfirmTransaction(signature.Result, Commitment.Processed);
             if (signature.WasSuccessful && confirmed)
             if (signature.WasSuccessful && confirmed)
             {
             {
@@ -107,6 +107,7 @@ namespace Solana.Unity.Bolt.Test
             if (signature.ErrorData != null) {
             if (signature.ErrorData != null) {
                 errorMessage += "\n" + string.Join("\n", signature.ErrorData.Logs);
                 errorMessage += "\n" + string.Join("\n", signature.ErrorData.Logs);
             }
             }
+            Console.WriteLine(errorMessage);
             throw new Exception(errorMessage);
             throw new Exception(errorMessage);
         }
         }
 
 

+ 1 - 0
clients/csharp/Solana.Unity.Bolt/WorldProgram/Bolt/DestroyComponent.cs

@@ -30,6 +30,7 @@ namespace Bolt {
         public static async Task<DestroyComponentInstruction> DestroyComponent(PublicKey authority, PublicKey receiver, PublicKey entity, PublicKey componentProgram, PublicKey componentPda) {
         public static async Task<DestroyComponentInstruction> DestroyComponent(PublicKey authority, PublicKey receiver, PublicKey entity, PublicKey componentProgram, PublicKey componentPda) {
             var componentProgramData = WorldProgram.FindComponentProgramDataPda(componentProgram);
             var componentProgramData = WorldProgram.FindComponentProgramDataPda(componentProgram);
             var destroyComponent = new DestroyComponentAccounts() {
             var destroyComponent = new DestroyComponentAccounts() {
+                CpiAuth = WorldProgram.CPI_AUTH_ADDRESS,
                 Authority = authority,
                 Authority = authority,
                 Receiver = receiver,
                 Receiver = receiver,
                 Entity = entity,
                 Entity = entity,

+ 1 - 0
clients/csharp/Solana.Unity.Bolt/WorldProgram/Bolt/InitializeComponent.cs

@@ -30,6 +30,7 @@ namespace Bolt {
 
 
         public static async Task<InitializeComponentInstruction> InitializeComponent(PublicKey payer, PublicKey entity, PublicKey componentId, PublicKey componentPda, PublicKey authority = null) {
         public static async Task<InitializeComponentInstruction> InitializeComponent(PublicKey payer, PublicKey entity, PublicKey componentId, PublicKey componentPda, PublicKey authority = null) {
             var initializeComponent = new InitializeComponentAccounts() {
             var initializeComponent = new InitializeComponentAccounts() {
+                CpiAuth = WorldProgram.CPI_AUTH_ADDRESS,
                 Payer = payer,
                 Payer = payer,
                 Entity = entity,
                 Entity = entity,
                 Data = componentPda,
                 Data = componentPda,

+ 648 - 567
clients/csharp/Solana.Unity.Bolt/WorldProgram/Generated.cs

@@ -1,568 +1,649 @@
-#pragma warning disable CS1591
-
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Numerics;
-using System.Threading.Tasks;
-using Solana.Unity;
-using Solana.Unity.Programs.Abstract;
-using Solana.Unity.Programs.Utilities;
-using Solana.Unity.Rpc;
-using Solana.Unity.Rpc.Builders;
-using Solana.Unity.Rpc.Core.Http;
-using Solana.Unity.Rpc.Core.Sockets;
-using Solana.Unity.Rpc.Types;
-using Solana.Unity.Wallet;
-using World;
-using World.Program;
-using World.Errors;
-using World.Accounts;
-using World.Types;
-
-namespace World
-{
-    namespace Accounts
-    {
-        public partial class Entity
-        {
-            public static ulong ACCOUNT_DISCRIMINATOR => 1751670451238706478UL;
-            public static ReadOnlySpan<byte> ACCOUNT_DISCRIMINATOR_BYTES => new byte[]{46, 157, 161, 161, 254, 46, 79, 24};
-            public static string ACCOUNT_DISCRIMINATOR_B58 => "8oEQa6zH67R";
-            public ulong Id { get; set; }
-
-            public static Entity Deserialize(ReadOnlySpan<byte> _data)
-            {
-                int offset = 0;
-                ulong accountHashValue = _data.GetU64(offset);
-                offset += 8;
-                if (accountHashValue != ACCOUNT_DISCRIMINATOR)
-                {
-                    return null;
-                }
-
-                Entity result = new Entity();
-                result.Id = _data.GetU64(offset);
-                offset += 8;
-                return result;
-            }
-        }
-
-        public partial class Registry
-        {
-            public static ulong ACCOUNT_DISCRIMINATOR => 15779688099924061743UL;
-            public static ReadOnlySpan<byte> ACCOUNT_DISCRIMINATOR_BYTES => new byte[]{47, 174, 110, 246, 184, 182, 252, 218};
-            public static string ACCOUNT_DISCRIMINATOR_B58 => "8ya1XGY4XBP";
-            public ulong Worlds { get; set; }
-
-            public static Registry Deserialize(ReadOnlySpan<byte> _data)
-            {
-                int offset = 0;
-                ulong accountHashValue = _data.GetU64(offset);
-                offset += 8;
-                if (accountHashValue != ACCOUNT_DISCRIMINATOR)
-                {
-                    return null;
-                }
-
-                Registry result = new Registry();
-                result.Worlds = _data.GetU64(offset);
-                offset += 8;
-                return result;
-            }
-        }
-
-        public partial class World
-        {
-            public static ulong ACCOUNT_DISCRIMINATOR => 8978805993381703057UL;
-            public static ReadOnlySpan<byte> ACCOUNT_DISCRIMINATOR_BYTES => new byte[]{145, 45, 170, 174, 122, 32, 155, 124};
-            public static string ACCOUNT_DISCRIMINATOR_B58 => "RHQudtaQtu1";
-            public ulong Id { get; set; }
-
-            public ulong Entities { get; set; }
-
-            public PublicKey[] Authorities { get; set; }
-
-            public bool Permissionless { get; set; }
-
-            public byte[] Systems { get; set; }
-
-            public static World Deserialize(ReadOnlySpan<byte> _data)
-            {
-                int offset = 0;
-                ulong accountHashValue = _data.GetU64(offset);
-                offset += 8;
-                if (accountHashValue != ACCOUNT_DISCRIMINATOR)
-                {
-                    return null;
-                }
-
-                World result = new World();
-                result.Id = _data.GetU64(offset);
-                offset += 8;
-                result.Entities = _data.GetU64(offset);
-                offset += 8;
-                int resultAuthoritiesLength = (int)_data.GetU32(offset);
-                offset += 4;
-                result.Authorities = new PublicKey[resultAuthoritiesLength];
-                for (uint resultAuthoritiesIdx = 0; resultAuthoritiesIdx < resultAuthoritiesLength; resultAuthoritiesIdx++)
-                {
-                    result.Authorities[resultAuthoritiesIdx] = _data.GetPubKey(offset);
-                    offset += 32;
-                }
-
-                result.Permissionless = _data.GetBool(offset);
-                offset += 1;
-                int resultSystemsLength = (int)_data.GetU32(offset);
-                offset += 4;
-                result.Systems = _data.GetBytes(offset, resultSystemsLength);
-                offset += resultSystemsLength;
-                return result;
-            }
-        }
-    }
-
-    namespace Errors
-    {
-        public enum WorldErrorKind : uint
-        {
-            InvalidAuthority = 6000U,
-            InvalidSystemOutput = 6001U,
-            WorldAccountMismatch = 6002U,
-            TooManyAuthorities = 6003U,
-            AuthorityNotFound = 6004U,
-            SystemNotApproved = 6005U
-        }
-    }
-
-    namespace Types
-    {
-    }
-
-    public partial class WorldClient : TransactionalBaseClient<WorldErrorKind>
-    {
-        public WorldClient(IRpcClient rpcClient, IStreamingRpcClient streamingRpcClient, PublicKey programId = null) : base(rpcClient, streamingRpcClient, programId ?? new PublicKey(WorldProgram.ID))
-        {
-        }
-
-        public async Task<Solana.Unity.Programs.Models.ProgramAccountsResultWrapper<List<Entity>>> GetEntitysAsync(string programAddress = WorldProgram.ID, Commitment commitment = Commitment.Confirmed)
-        {
-            var list = new List<Solana.Unity.Rpc.Models.MemCmp>{new Solana.Unity.Rpc.Models.MemCmp{Bytes = Entity.ACCOUNT_DISCRIMINATOR_B58, Offset = 0}};
-            var res = await RpcClient.GetProgramAccountsAsync(programAddress, commitment, memCmpList: list);
-            if (!res.WasSuccessful || !(res.Result?.Count > 0))
-                return new Solana.Unity.Programs.Models.ProgramAccountsResultWrapper<List<Entity>>(res);
-            List<Entity> resultingAccounts = new List<Entity>(res.Result.Count);
-            resultingAccounts.AddRange(res.Result.Select(result => Entity.Deserialize(Convert.FromBase64String(result.Account.Data[0]))));
-            return new Solana.Unity.Programs.Models.ProgramAccountsResultWrapper<List<Entity>>(res, resultingAccounts);
-        }
-
-        public async Task<Solana.Unity.Programs.Models.ProgramAccountsResultWrapper<List<Registry>>> GetRegistrysAsync(string programAddress = WorldProgram.ID, Commitment commitment = Commitment.Confirmed)
-        {
-            var list = new List<Solana.Unity.Rpc.Models.MemCmp>{new Solana.Unity.Rpc.Models.MemCmp{Bytes = Registry.ACCOUNT_DISCRIMINATOR_B58, Offset = 0}};
-            var res = await RpcClient.GetProgramAccountsAsync(programAddress, commitment, memCmpList: list);
-            if (!res.WasSuccessful || !(res.Result?.Count > 0))
-                return new Solana.Unity.Programs.Models.ProgramAccountsResultWrapper<List<Registry>>(res);
-            List<Registry> resultingAccounts = new List<Registry>(res.Result.Count);
-            resultingAccounts.AddRange(res.Result.Select(result => Registry.Deserialize(Convert.FromBase64String(result.Account.Data[0]))));
-            return new Solana.Unity.Programs.Models.ProgramAccountsResultWrapper<List<Registry>>(res, resultingAccounts);
-        }
-
-        public async Task<Solana.Unity.Programs.Models.ProgramAccountsResultWrapper<List<World.Accounts.World>>> GetWorldsAsync(string programAddress = WorldProgram.ID, Commitment commitment = Commitment.Confirmed)
-        {
-            var list = new List<Solana.Unity.Rpc.Models.MemCmp>{new Solana.Unity.Rpc.Models.MemCmp{Bytes = World.Accounts.World.ACCOUNT_DISCRIMINATOR_B58, Offset = 0}};
-            var res = await RpcClient.GetProgramAccountsAsync(programAddress, commitment, memCmpList: list);
-            if (!res.WasSuccessful || !(res.Result?.Count > 0))
-                return new Solana.Unity.Programs.Models.ProgramAccountsResultWrapper<List<World.Accounts.World>>(res);
-            List<World.Accounts.World> resultingAccounts = new List<World.Accounts.World>(res.Result.Count);
-            resultingAccounts.AddRange(res.Result.Select(result => World.Accounts.World.Deserialize(Convert.FromBase64String(result.Account.Data[0]))));
-            return new Solana.Unity.Programs.Models.ProgramAccountsResultWrapper<List<World.Accounts.World>>(res, resultingAccounts);
-        }
-
-        public async Task<Solana.Unity.Programs.Models.AccountResultWrapper<Entity>> GetEntityAsync(string accountAddress, Commitment commitment = Commitment.Finalized)
-        {
-            var res = await RpcClient.GetAccountInfoAsync(accountAddress, commitment);
-            if (!res.WasSuccessful)
-                return new Solana.Unity.Programs.Models.AccountResultWrapper<Entity>(res);
-            var resultingAccount = Entity.Deserialize(Convert.FromBase64String(res.Result.Value.Data[0]));
-            return new Solana.Unity.Programs.Models.AccountResultWrapper<Entity>(res, resultingAccount);
-        }
-
-        public async Task<Solana.Unity.Programs.Models.AccountResultWrapper<Registry>> GetRegistryAsync(string accountAddress, Commitment commitment = Commitment.Finalized)
-        {
-            var res = await RpcClient.GetAccountInfoAsync(accountAddress, commitment);
-            if (!res.WasSuccessful)
-                return new Solana.Unity.Programs.Models.AccountResultWrapper<Registry>(res);
-            var resultingAccount = Registry.Deserialize(Convert.FromBase64String(res.Result.Value.Data[0]));
-            return new Solana.Unity.Programs.Models.AccountResultWrapper<Registry>(res, resultingAccount);
-        }
-
-        public async Task<Solana.Unity.Programs.Models.AccountResultWrapper<World.Accounts.World>> GetWorldAsync(string accountAddress, Commitment commitment = Commitment.Finalized)
-        {
-            var res = await RpcClient.GetAccountInfoAsync(accountAddress, commitment);
-            if (!res.WasSuccessful)
-                return new Solana.Unity.Programs.Models.AccountResultWrapper<World.Accounts.World>(res);
-            var resultingAccount = World.Accounts.World.Deserialize(Convert.FromBase64String(res.Result.Value.Data[0]));
-            return new Solana.Unity.Programs.Models.AccountResultWrapper<World.Accounts.World>(res, resultingAccount);
-        }
-
-        public async Task<SubscriptionState> SubscribeEntityAsync(string accountAddress, Action<SubscriptionState, Solana.Unity.Rpc.Messages.ResponseValue<Solana.Unity.Rpc.Models.AccountInfo>, Entity> callback, Commitment commitment = Commitment.Finalized)
-        {
-            SubscriptionState res = await StreamingRpcClient.SubscribeAccountInfoAsync(accountAddress, (s, e) =>
-            {
-                Entity parsingResult = null;
-                if (e.Value?.Data?.Count > 0)
-                    parsingResult = Entity.Deserialize(Convert.FromBase64String(e.Value.Data[0]));
-                callback(s, e, parsingResult);
-            }, commitment);
-            return res;
-        }
-
-        public async Task<SubscriptionState> SubscribeRegistryAsync(string accountAddress, Action<SubscriptionState, Solana.Unity.Rpc.Messages.ResponseValue<Solana.Unity.Rpc.Models.AccountInfo>, Registry> callback, Commitment commitment = Commitment.Finalized)
-        {
-            SubscriptionState res = await StreamingRpcClient.SubscribeAccountInfoAsync(accountAddress, (s, e) =>
-            {
-                Registry parsingResult = null;
-                if (e.Value?.Data?.Count > 0)
-                    parsingResult = Registry.Deserialize(Convert.FromBase64String(e.Value.Data[0]));
-                callback(s, e, parsingResult);
-            }, commitment);
-            return res;
-        }
-
-        public async Task<SubscriptionState> SubscribeWorldAsync(string accountAddress, Action<SubscriptionState, Solana.Unity.Rpc.Messages.ResponseValue<Solana.Unity.Rpc.Models.AccountInfo>, World.Accounts.World> callback, Commitment commitment = Commitment.Finalized)
-        {
-            SubscriptionState res = await StreamingRpcClient.SubscribeAccountInfoAsync(accountAddress, (s, e) =>
-            {
-                World.Accounts.World parsingResult = null;
-                if (e.Value?.Data?.Count > 0)
-                    parsingResult = World.Accounts.World.Deserialize(Convert.FromBase64String(e.Value.Data[0]));
-                callback(s, e, parsingResult);
-            }, commitment);
-            return res;
-        }
-
-        protected override Dictionary<uint, ProgramError<WorldErrorKind>> BuildErrorsDictionary()
-        {
-            return new Dictionary<uint, ProgramError<WorldErrorKind>>{{6000U, new ProgramError<WorldErrorKind>(WorldErrorKind.InvalidAuthority, "Invalid authority for instruction")}, {6001U, new ProgramError<WorldErrorKind>(WorldErrorKind.InvalidSystemOutput, "Invalid system output")}, {6002U, new ProgramError<WorldErrorKind>(WorldErrorKind.WorldAccountMismatch, "The provided world account does not match the expected PDA.")}, {6003U, new ProgramError<WorldErrorKind>(WorldErrorKind.TooManyAuthorities, "Exceed the maximum number of authorities.")}, {6004U, new ProgramError<WorldErrorKind>(WorldErrorKind.AuthorityNotFound, "The provided authority not found")}, {6005U, new ProgramError<WorldErrorKind>(WorldErrorKind.SystemNotApproved, "The system is not approved in this world instance")}, };
-        }
-    }
-
-    namespace Program
-    {
-        public class AddAuthorityAccounts
-        {
-            public PublicKey Authority { get; set; }
-
-            public PublicKey NewAuthority { get; set; }
-
-            public PublicKey World { get; set; }
-
-            public PublicKey SystemProgram { get; set; } = new PublicKey("11111111111111111111111111111111");
-        }
-
-        public class AddEntityAccounts
-        {
-            public PublicKey Payer { get; set; }
-
-            public PublicKey Entity { get; set; }
-
-            public PublicKey World { get; set; }
-
-            public PublicKey SystemProgram { get; set; } = new PublicKey("11111111111111111111111111111111");
-        }
-
-        public class ApplyAccounts
-        {
-            public PublicKey BoltSystem { get; set; }
-
-            public PublicKey Authority { get; set; }
-
-            public PublicKey CpiAuth { get; set; } = new PublicKey("B2f2y3QTBv346wE6nWKor72AUhUvFF6mPk7TWCF2QVhi");
-            public PublicKey World { get; set; }
-        }
-
-        public class ApplyWithSessionAccounts
-        {
-            public PublicKey BoltSystem { get; set; }
-
-            public PublicKey Authority { get; set; }
-
-            public PublicKey CpiAuth { get; set; } = new PublicKey("B2f2y3QTBv346wE6nWKor72AUhUvFF6mPk7TWCF2QVhi");
-            public PublicKey World { get; set; }
-
-            public PublicKey SessionToken { get; set; }
-        }
-
-        public class ApproveSystemAccounts
-        {
-            public PublicKey Authority { get; set; }
-
-            public PublicKey World { get; set; }
-
-            public PublicKey System { get; set; }
-
-            public PublicKey SystemProgram { get; set; } = new PublicKey("11111111111111111111111111111111");
-        }
-
-        public class DestroyComponentAccounts
-        {
-            public PublicKey Authority { get; set; }
-
-            public PublicKey Receiver { get; set; }
-
-            public PublicKey ComponentProgram { get; set; }
-
-            public PublicKey ComponentProgramData { get; set; }
-
-            public PublicKey Entity { get; set; }
-
-            public PublicKey Component { get; set; }
-
-            public PublicKey CpiAuth { get; set; } = new PublicKey("B2f2y3QTBv346wE6nWKor72AUhUvFF6mPk7TWCF2QVhi");
-            public PublicKey SystemProgram { get; set; } = new PublicKey("11111111111111111111111111111111");
-        }
-
-        public class InitializeComponentAccounts
-        {
-            public PublicKey Payer { get; set; }
-
-            public PublicKey Data { get; set; }
-
-            public PublicKey Entity { get; set; }
-
-            public PublicKey ComponentProgram { get; set; }
-
-            public PublicKey Authority { get; set; }
-
-            public PublicKey CpiAuth { get; set; } = new PublicKey("B2f2y3QTBv346wE6nWKor72AUhUvFF6mPk7TWCF2QVhi");
-            public PublicKey SystemProgram { get; set; } = new PublicKey("11111111111111111111111111111111");
-        }
-
-        public class InitializeNewWorldAccounts
-        {
-            public PublicKey Payer { get; set; }
-
-            public PublicKey World { get; set; }
-
-            public PublicKey Registry { get; set; }
-
-            public PublicKey SystemProgram { get; set; } = new PublicKey("11111111111111111111111111111111");
-        }
-
-        public class InitializeRegistryAccounts
-        {
-            public PublicKey Registry { get; set; }
-
-            public PublicKey Payer { get; set; }
-
-            public PublicKey SystemProgram { get; set; } = new PublicKey("11111111111111111111111111111111");
-        }
-
-        public class RemoveAuthorityAccounts
-        {
-            public PublicKey Authority { get; set; }
-
-            public PublicKey AuthorityToDelete { get; set; }
-
-            public PublicKey World { get; set; }
-
-            public PublicKey SystemProgram { get; set; } = new PublicKey("11111111111111111111111111111111");
-        }
-
-        public class RemoveSystemAccounts
-        {
-            public PublicKey Authority { get; set; }
-
-            public PublicKey World { get; set; }
-
-            public PublicKey System { get; set; }
-
-            public PublicKey SystemProgram { get; set; } = new PublicKey("11111111111111111111111111111111");
-        }
-
-        public partial class WorldProgram
-        {
-            public const string ID = "WorLD15A7CrDwLcLy4fRqtaTb9fbd8o8iqiEMUDse2n";
-            public static Solana.Unity.Rpc.Models.TransactionInstruction AddAuthority(AddAuthorityAccounts accounts, ulong world_id, PublicKey programId = null)
-            {
-                programId ??= new(ID);
-                List<Solana.Unity.Rpc.Models.AccountMeta> keys = new()
-                {Solana.Unity.Rpc.Models.AccountMeta.Writable(accounts.Authority, true), Solana.Unity.Rpc.Models.AccountMeta.ReadOnly(accounts.NewAuthority, false), Solana.Unity.Rpc.Models.AccountMeta.Writable(accounts.World, false), Solana.Unity.Rpc.Models.AccountMeta.ReadOnly(accounts.SystemProgram, false)};
-                byte[] _data = new byte[1200];
-                int offset = 0;
-                _data.WriteU64(13217455069452700133UL, offset);
-                offset += 8;
-                _data.WriteU64(world_id, offset);
-                offset += 8;
-                byte[] resultData = new byte[offset];
-                Array.Copy(_data, resultData, offset);
-                return new Solana.Unity.Rpc.Models.TransactionInstruction{Keys = keys, ProgramId = programId.KeyBytes, Data = resultData};
-            }
-
-            public static Solana.Unity.Rpc.Models.TransactionInstruction AddEntity(AddEntityAccounts accounts, byte[] extra_seed, PublicKey programId = null)
-            {
-                programId ??= new(ID);
-                List<Solana.Unity.Rpc.Models.AccountMeta> keys = new()
-                {Solana.Unity.Rpc.Models.AccountMeta.Writable(accounts.Payer, true), Solana.Unity.Rpc.Models.AccountMeta.Writable(accounts.Entity, false), Solana.Unity.Rpc.Models.AccountMeta.Writable(accounts.World, false), Solana.Unity.Rpc.Models.AccountMeta.ReadOnly(accounts.SystemProgram, false)};
-                byte[] _data = new byte[1200];
-                int offset = 0;
-                _data.WriteU64(4121062988444201379UL, offset);
-                offset += 8;
-                if (extra_seed != null)
-                {
-                    _data.WriteU8(1, offset);
-                    offset += 1;
-                    _data.WriteS32(extra_seed.Length, offset);
-                    offset += 4;
-                    _data.WriteSpan(extra_seed, offset);
-                    offset += extra_seed.Length;
-                }
-                else
-                {
-                    _data.WriteU8(0, offset);
-                    offset += 1;
-                }
-
-                byte[] resultData = new byte[offset];
-                Array.Copy(_data, resultData, offset);
-                return new Solana.Unity.Rpc.Models.TransactionInstruction{Keys = keys, ProgramId = programId.KeyBytes, Data = resultData};
-            }
-
-            public static Solana.Unity.Rpc.Models.TransactionInstruction Apply(ApplyAccounts accounts, byte[] args, PublicKey programId = null)
-            {
-                programId ??= new(ID);
-                List<Solana.Unity.Rpc.Models.AccountMeta> keys = new()
-                {Solana.Unity.Rpc.Models.AccountMeta.ReadOnly(accounts.BoltSystem, false), Solana.Unity.Rpc.Models.AccountMeta.ReadOnly(accounts.Authority, true), Solana.Unity.Rpc.Models.AccountMeta.ReadOnly(accounts.CpiAuth, false), Solana.Unity.Rpc.Models.AccountMeta.ReadOnly(accounts.World, false)};
-                byte[] _data = new byte[1200];
-                int offset = 0;
-                _data.WriteU64(16258613031726085112UL, offset);
-                offset += 8;
-                _data.WriteS32(args.Length, offset);
-                offset += 4;
-                _data.WriteSpan(args, offset);
-                offset += args.Length;
-                byte[] resultData = new byte[offset];
-                Array.Copy(_data, resultData, offset);
-                return new Solana.Unity.Rpc.Models.TransactionInstruction{Keys = keys, ProgramId = programId.KeyBytes, Data = resultData};
-            }
-
-            public static Solana.Unity.Rpc.Models.TransactionInstruction ApplyWithSession(ApplyWithSessionAccounts accounts, byte[] args, PublicKey programId = null)
-            {
-                programId ??= new(ID);
-                List<Solana.Unity.Rpc.Models.AccountMeta> keys = new()
-                {Solana.Unity.Rpc.Models.AccountMeta.ReadOnly(accounts.BoltSystem, false), Solana.Unity.Rpc.Models.AccountMeta.ReadOnly(accounts.Authority, true), Solana.Unity.Rpc.Models.AccountMeta.ReadOnly(accounts.CpiAuth, false), Solana.Unity.Rpc.Models.AccountMeta.ReadOnly(accounts.World, false), Solana.Unity.Rpc.Models.AccountMeta.ReadOnly(accounts.SessionToken, false)};
-                byte[] _data = new byte[1200];
-                int offset = 0;
-                _data.WriteU64(7459768094276011477UL, offset);
-                offset += 8;
-                _data.WriteS32(args.Length, offset);
-                offset += 4;
-                _data.WriteSpan(args, offset);
-                offset += args.Length;
-                byte[] resultData = new byte[offset];
-                Array.Copy(_data, resultData, offset);
-                return new Solana.Unity.Rpc.Models.TransactionInstruction{Keys = keys, ProgramId = programId.KeyBytes, Data = resultData};
-            }
-
-            public static Solana.Unity.Rpc.Models.TransactionInstruction ApproveSystem(ApproveSystemAccounts accounts, PublicKey programId = null)
-            {
-                programId ??= new(ID);
-                List<Solana.Unity.Rpc.Models.AccountMeta> keys = new()
-                {Solana.Unity.Rpc.Models.AccountMeta.Writable(accounts.Authority, true), Solana.Unity.Rpc.Models.AccountMeta.Writable(accounts.World, false), Solana.Unity.Rpc.Models.AccountMeta.ReadOnly(accounts.System, false), Solana.Unity.Rpc.Models.AccountMeta.ReadOnly(accounts.SystemProgram, false)};
-                byte[] _data = new byte[1200];
-                int offset = 0;
-                _data.WriteU64(8777308090533520754UL, offset);
-                offset += 8;
-                byte[] resultData = new byte[offset];
-                Array.Copy(_data, resultData, offset);
-                return new Solana.Unity.Rpc.Models.TransactionInstruction{Keys = keys, ProgramId = programId.KeyBytes, Data = resultData};
-            }
-
-            public static Solana.Unity.Rpc.Models.TransactionInstruction DestroyComponent(DestroyComponentAccounts accounts, PublicKey programId = null)
-            {
-                programId ??= new(ID);
-                List<Solana.Unity.Rpc.Models.AccountMeta> keys = new()
-                {Solana.Unity.Rpc.Models.AccountMeta.Writable(accounts.Authority, true), Solana.Unity.Rpc.Models.AccountMeta.Writable(accounts.Receiver, false), Solana.Unity.Rpc.Models.AccountMeta.ReadOnly(accounts.ComponentProgram, false), Solana.Unity.Rpc.Models.AccountMeta.ReadOnly(accounts.ComponentProgramData, false), Solana.Unity.Rpc.Models.AccountMeta.ReadOnly(accounts.Entity, false), Solana.Unity.Rpc.Models.AccountMeta.Writable(accounts.Component, false), Solana.Unity.Rpc.Models.AccountMeta.ReadOnly(accounts.CpiAuth, false), Solana.Unity.Rpc.Models.AccountMeta.ReadOnly(accounts.SystemProgram, false)};
-                byte[] _data = new byte[1200];
-                int offset = 0;
-                _data.WriteU64(5321952129328727336UL, offset);
-                offset += 8;
-                byte[] resultData = new byte[offset];
-                Array.Copy(_data, resultData, offset);
-                return new Solana.Unity.Rpc.Models.TransactionInstruction{Keys = keys, ProgramId = programId.KeyBytes, Data = resultData};
-            }
-
-            public static Solana.Unity.Rpc.Models.TransactionInstruction InitializeComponent(InitializeComponentAccounts accounts, PublicKey programId = null)
-            {
-                programId ??= new(ID);
-                List<Solana.Unity.Rpc.Models.AccountMeta> keys = new()
-                {Solana.Unity.Rpc.Models.AccountMeta.Writable(accounts.Payer, true), Solana.Unity.Rpc.Models.AccountMeta.Writable(accounts.Data, false), Solana.Unity.Rpc.Models.AccountMeta.ReadOnly(accounts.Entity, false), Solana.Unity.Rpc.Models.AccountMeta.ReadOnly(accounts.ComponentProgram, false), Solana.Unity.Rpc.Models.AccountMeta.ReadOnly(accounts.Authority, false), Solana.Unity.Rpc.Models.AccountMeta.ReadOnly(accounts.CpiAuth, false), Solana.Unity.Rpc.Models.AccountMeta.ReadOnly(accounts.SystemProgram, false)};
-                byte[] _data = new byte[1200];
-                int offset = 0;
-                _data.WriteU64(2179155133888827172UL, offset);
-                offset += 8;
-                byte[] resultData = new byte[offset];
-                Array.Copy(_data, resultData, offset);
-                return new Solana.Unity.Rpc.Models.TransactionInstruction{Keys = keys, ProgramId = programId.KeyBytes, Data = resultData};
-            }
-
-            public static Solana.Unity.Rpc.Models.TransactionInstruction InitializeNewWorld(InitializeNewWorldAccounts accounts, PublicKey programId = null)
-            {
-                programId ??= new(ID);
-                List<Solana.Unity.Rpc.Models.AccountMeta> keys = new()
-                {Solana.Unity.Rpc.Models.AccountMeta.Writable(accounts.Payer, true), Solana.Unity.Rpc.Models.AccountMeta.Writable(accounts.World, false), Solana.Unity.Rpc.Models.AccountMeta.Writable(accounts.Registry, false), Solana.Unity.Rpc.Models.AccountMeta.ReadOnly(accounts.SystemProgram, false)};
-                byte[] _data = new byte[1200];
-                int offset = 0;
-                _data.WriteU64(7118163274173538327UL, offset);
-                offset += 8;
-                byte[] resultData = new byte[offset];
-                Array.Copy(_data, resultData, offset);
-                return new Solana.Unity.Rpc.Models.TransactionInstruction{Keys = keys, ProgramId = programId.KeyBytes, Data = resultData};
-            }
-
-            public static Solana.Unity.Rpc.Models.TransactionInstruction InitializeRegistry(InitializeRegistryAccounts accounts, PublicKey programId = null)
-            {
-                programId ??= new(ID);
-                List<Solana.Unity.Rpc.Models.AccountMeta> keys = new()
-                {Solana.Unity.Rpc.Models.AccountMeta.Writable(accounts.Registry, false), Solana.Unity.Rpc.Models.AccountMeta.Writable(accounts.Payer, true), Solana.Unity.Rpc.Models.AccountMeta.ReadOnly(accounts.SystemProgram, false)};
-                byte[] _data = new byte[1200];
-                int offset = 0;
-                _data.WriteU64(4321548737212364221UL, offset);
-                offset += 8;
-                byte[] resultData = new byte[offset];
-                Array.Copy(_data, resultData, offset);
-                return new Solana.Unity.Rpc.Models.TransactionInstruction{Keys = keys, ProgramId = programId.KeyBytes, Data = resultData};
-            }
-
-            public static Solana.Unity.Rpc.Models.TransactionInstruction RemoveAuthority(RemoveAuthorityAccounts accounts, ulong world_id, PublicKey programId = null)
-            {
-                programId ??= new(ID);
-                List<Solana.Unity.Rpc.Models.AccountMeta> keys = new()
-                {Solana.Unity.Rpc.Models.AccountMeta.Writable(accounts.Authority, true), Solana.Unity.Rpc.Models.AccountMeta.ReadOnly(accounts.AuthorityToDelete, false), Solana.Unity.Rpc.Models.AccountMeta.Writable(accounts.World, false), Solana.Unity.Rpc.Models.AccountMeta.ReadOnly(accounts.SystemProgram, false)};
-                byte[] _data = new byte[1200];
-                int offset = 0;
-                _data.WriteU64(15585545156648003826UL, offset);
-                offset += 8;
-                _data.WriteU64(world_id, offset);
-                offset += 8;
-                byte[] resultData = new byte[offset];
-                Array.Copy(_data, resultData, offset);
-                return new Solana.Unity.Rpc.Models.TransactionInstruction{Keys = keys, ProgramId = programId.KeyBytes, Data = resultData};
-            }
-
-            public static Solana.Unity.Rpc.Models.TransactionInstruction RemoveSystem(RemoveSystemAccounts accounts, PublicKey programId = null)
-            {
-                programId ??= new(ID);
-                List<Solana.Unity.Rpc.Models.AccountMeta> keys = new()
-                {Solana.Unity.Rpc.Models.AccountMeta.Writable(accounts.Authority, true), Solana.Unity.Rpc.Models.AccountMeta.Writable(accounts.World, false), Solana.Unity.Rpc.Models.AccountMeta.ReadOnly(accounts.System, false), Solana.Unity.Rpc.Models.AccountMeta.ReadOnly(accounts.SystemProgram, false)};
-                byte[] _data = new byte[1200];
-                int offset = 0;
-                _data.WriteU64(8688994685429436634UL, offset);
-                offset += 8;
-                byte[] resultData = new byte[offset];
-                Array.Copy(_data, resultData, offset);
-                return new Solana.Unity.Rpc.Models.TransactionInstruction{Keys = keys, ProgramId = programId.KeyBytes, Data = resultData};
-            }
-        }
-    }
+#pragma warning disable CS1591
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Numerics;
+using System.Threading.Tasks;
+using Solana.Unity;
+using Solana.Unity.Programs.Abstract;
+using Solana.Unity.Programs.Utilities;
+using Solana.Unity.Rpc;
+using Solana.Unity.Rpc.Builders;
+using Solana.Unity.Rpc.Core.Http;
+using Solana.Unity.Rpc.Core.Sockets;
+using Solana.Unity.Rpc.Types;
+using Solana.Unity.Wallet;
+using World;
+using World.Program;
+using World.Errors;
+using World.Accounts;
+using World.Types;
+
+namespace World
+{
+    namespace Accounts
+    {
+        public partial class Entity
+        {
+            public static ulong ACCOUNT_DISCRIMINATOR => 1751670451238706478UL;
+            public static ReadOnlySpan<byte> ACCOUNT_DISCRIMINATOR_BYTES => new byte[]{46, 157, 161, 161, 254, 46, 79, 24};
+            public static string ACCOUNT_DISCRIMINATOR_B58 => "8oEQa6zH67R";
+            public ulong Id { get; set; }
+
+            public static Entity Deserialize(ReadOnlySpan<byte> _data)
+            {
+                int offset = 0;
+                ulong accountHashValue = _data.GetU64(offset);
+                offset += 8;
+                if (accountHashValue != ACCOUNT_DISCRIMINATOR)
+                {
+                    return null;
+                }
+
+                Entity result = new Entity();
+                result.Id = _data.GetU64(offset);
+                offset += 8;
+                return result;
+            }
+        }
+
+        public partial class Registry
+        {
+            public static ulong ACCOUNT_DISCRIMINATOR => 15779688099924061743UL;
+            public static ReadOnlySpan<byte> ACCOUNT_DISCRIMINATOR_BYTES => new byte[]{47, 174, 110, 246, 184, 182, 252, 218};
+            public static string ACCOUNT_DISCRIMINATOR_B58 => "8ya1XGY4XBP";
+            public ulong Worlds { get; set; }
+
+            public static Registry Deserialize(ReadOnlySpan<byte> _data)
+            {
+                int offset = 0;
+                ulong accountHashValue = _data.GetU64(offset);
+                offset += 8;
+                if (accountHashValue != ACCOUNT_DISCRIMINATOR)
+                {
+                    return null;
+                }
+
+                Registry result = new Registry();
+                result.Worlds = _data.GetU64(offset);
+                offset += 8;
+                return result;
+            }
+        }
+
+        public partial class SessionToken
+        {
+            public static ulong ACCOUNT_DISCRIMINATOR => 1081168673100727529UL;
+            public static ReadOnlySpan<byte> ACCOUNT_DISCRIMINATOR_BYTES => new byte[]{233, 4, 115, 14, 46, 21, 1, 15};
+            public static string ACCOUNT_DISCRIMINATOR_B58 => "fyZWTdUu1pS";
+            public PublicKey Authority { get; set; }
+
+            public PublicKey TargetProgram { get; set; }
+
+            public PublicKey SessionSigner { get; set; }
+
+            public long ValidUntil { get; set; }
+
+            public static SessionToken Deserialize(ReadOnlySpan<byte> _data)
+            {
+                int offset = 0;
+                ulong accountHashValue = _data.GetU64(offset);
+                offset += 8;
+                if (accountHashValue != ACCOUNT_DISCRIMINATOR)
+                {
+                    return null;
+                }
+
+                SessionToken result = new SessionToken();
+                result.Authority = _data.GetPubKey(offset);
+                offset += 32;
+                result.TargetProgram = _data.GetPubKey(offset);
+                offset += 32;
+                result.SessionSigner = _data.GetPubKey(offset);
+                offset += 32;
+                result.ValidUntil = _data.GetS64(offset);
+                offset += 8;
+                return result;
+            }
+        }
+
+        public partial class World
+        {
+            public static ulong ACCOUNT_DISCRIMINATOR => 8978805993381703057UL;
+            public static ReadOnlySpan<byte> ACCOUNT_DISCRIMINATOR_BYTES => new byte[]{145, 45, 170, 174, 122, 32, 155, 124};
+            public static string ACCOUNT_DISCRIMINATOR_B58 => "RHQudtaQtu1";
+            public ulong Id { get; set; }
+
+            public ulong Entities { get; set; }
+
+            public PublicKey[] Authorities { get; set; }
+
+            public bool Permissionless { get; set; }
+
+            public byte[] Systems { get; set; }
+
+            public static World Deserialize(ReadOnlySpan<byte> _data)
+            {
+                int offset = 0;
+                ulong accountHashValue = _data.GetU64(offset);
+                offset += 8;
+                if (accountHashValue != ACCOUNT_DISCRIMINATOR)
+                {
+                    return null;
+                }
+
+                World result = new World();
+                result.Id = _data.GetU64(offset);
+                offset += 8;
+                result.Entities = _data.GetU64(offset);
+                offset += 8;
+                int resultAuthoritiesLength = (int)_data.GetU32(offset);
+                offset += 4;
+                result.Authorities = new PublicKey[resultAuthoritiesLength];
+                for (uint resultAuthoritiesIdx = 0; resultAuthoritiesIdx < resultAuthoritiesLength; resultAuthoritiesIdx++)
+                {
+                    result.Authorities[resultAuthoritiesIdx] = _data.GetPubKey(offset);
+                    offset += 32;
+                }
+
+                result.Permissionless = _data.GetBool(offset);
+                offset += 1;
+                int resultSystemsLength = (int)_data.GetU32(offset);
+                offset += 4;
+                result.Systems = _data.GetBytes(offset, resultSystemsLength);
+                offset += resultSystemsLength;
+                return result;
+            }
+        }
+    }
+
+    namespace Errors
+    {
+        public enum WorldErrorKind : uint
+        {
+            InvalidAuthority = 6000U,
+            InvalidSystemOutput = 6001U,
+            WorldAccountMismatch = 6002U,
+            TooManyAuthorities = 6003U,
+            AuthorityNotFound = 6004U,
+            SystemNotApproved = 6005U,
+            InvalidComponentOwner = 6006U
+        }
+    }
+
+    namespace Types
+    {
+    }
+
+    public partial class WorldClient : TransactionalBaseClient<WorldErrorKind>
+    {
+        public WorldClient(IRpcClient rpcClient, IStreamingRpcClient streamingRpcClient, PublicKey programId = null) : base(rpcClient, streamingRpcClient, programId ?? new PublicKey(WorldProgram.ID))
+        {
+        }
+
+        public async Task<Solana.Unity.Programs.Models.ProgramAccountsResultWrapper<List<Entity>>> GetEntitysAsync(string programAddress = WorldProgram.ID, Commitment commitment = Commitment.Confirmed)
+        {
+            var list = new List<Solana.Unity.Rpc.Models.MemCmp>{new Solana.Unity.Rpc.Models.MemCmp{Bytes = Entity.ACCOUNT_DISCRIMINATOR_B58, Offset = 0}};
+            var res = await RpcClient.GetProgramAccountsAsync(programAddress, commitment, memCmpList: list);
+            if (!res.WasSuccessful || !(res.Result?.Count > 0))
+                return new Solana.Unity.Programs.Models.ProgramAccountsResultWrapper<List<Entity>>(res);
+            List<Entity> resultingAccounts = new List<Entity>(res.Result.Count);
+            resultingAccounts.AddRange(res.Result.Select(result => Entity.Deserialize(Convert.FromBase64String(result.Account.Data[0]))));
+            return new Solana.Unity.Programs.Models.ProgramAccountsResultWrapper<List<Entity>>(res, resultingAccounts);
+        }
+
+        public async Task<Solana.Unity.Programs.Models.ProgramAccountsResultWrapper<List<Registry>>> GetRegistrysAsync(string programAddress = WorldProgram.ID, Commitment commitment = Commitment.Confirmed)
+        {
+            var list = new List<Solana.Unity.Rpc.Models.MemCmp>{new Solana.Unity.Rpc.Models.MemCmp{Bytes = Registry.ACCOUNT_DISCRIMINATOR_B58, Offset = 0}};
+            var res = await RpcClient.GetProgramAccountsAsync(programAddress, commitment, memCmpList: list);
+            if (!res.WasSuccessful || !(res.Result?.Count > 0))
+                return new Solana.Unity.Programs.Models.ProgramAccountsResultWrapper<List<Registry>>(res);
+            List<Registry> resultingAccounts = new List<Registry>(res.Result.Count);
+            resultingAccounts.AddRange(res.Result.Select(result => Registry.Deserialize(Convert.FromBase64String(result.Account.Data[0]))));
+            return new Solana.Unity.Programs.Models.ProgramAccountsResultWrapper<List<Registry>>(res, resultingAccounts);
+        }
+
+        public async Task<Solana.Unity.Programs.Models.ProgramAccountsResultWrapper<List<SessionToken>>> GetSessionTokensAsync(string programAddress = WorldProgram.ID, Commitment commitment = Commitment.Confirmed)
+        {
+            var list = new List<Solana.Unity.Rpc.Models.MemCmp>{new Solana.Unity.Rpc.Models.MemCmp{Bytes = SessionToken.ACCOUNT_DISCRIMINATOR_B58, Offset = 0}};
+            var res = await RpcClient.GetProgramAccountsAsync(programAddress, commitment, memCmpList: list);
+            if (!res.WasSuccessful || !(res.Result?.Count > 0))
+                return new Solana.Unity.Programs.Models.ProgramAccountsResultWrapper<List<SessionToken>>(res);
+            List<SessionToken> resultingAccounts = new List<SessionToken>(res.Result.Count);
+            resultingAccounts.AddRange(res.Result.Select(result => SessionToken.Deserialize(Convert.FromBase64String(result.Account.Data[0]))));
+            return new Solana.Unity.Programs.Models.ProgramAccountsResultWrapper<List<SessionToken>>(res, resultingAccounts);
+        }
+
+        public async Task<Solana.Unity.Programs.Models.ProgramAccountsResultWrapper<List<World.Accounts.World>>> GetWorldsAsync(string programAddress = WorldProgram.ID, Commitment commitment = Commitment.Confirmed)
+        {
+            var list = new List<Solana.Unity.Rpc.Models.MemCmp>{new Solana.Unity.Rpc.Models.MemCmp{Bytes = World.Accounts.World.ACCOUNT_DISCRIMINATOR_B58, Offset = 0}};
+            var res = await RpcClient.GetProgramAccountsAsync(programAddress, commitment, memCmpList: list);
+            if (!res.WasSuccessful || !(res.Result?.Count > 0))
+                return new Solana.Unity.Programs.Models.ProgramAccountsResultWrapper<List<World.Accounts.World>>(res);
+            List<World.Accounts.World> resultingAccounts = new List<World.Accounts.World>(res.Result.Count);
+            resultingAccounts.AddRange(res.Result.Select(result => World.Accounts.World.Deserialize(Convert.FromBase64String(result.Account.Data[0]))));
+            return new Solana.Unity.Programs.Models.ProgramAccountsResultWrapper<List<World.Accounts.World>>(res, resultingAccounts);
+        }
+
+        public async Task<Solana.Unity.Programs.Models.AccountResultWrapper<Entity>> GetEntityAsync(string accountAddress, Commitment commitment = Commitment.Finalized)
+        {
+            var res = await RpcClient.GetAccountInfoAsync(accountAddress, commitment);
+            if (!res.WasSuccessful)
+                return new Solana.Unity.Programs.Models.AccountResultWrapper<Entity>(res);
+            var resultingAccount = Entity.Deserialize(Convert.FromBase64String(res.Result.Value.Data[0]));
+            return new Solana.Unity.Programs.Models.AccountResultWrapper<Entity>(res, resultingAccount);
+        }
+
+        public async Task<Solana.Unity.Programs.Models.AccountResultWrapper<Registry>> GetRegistryAsync(string accountAddress, Commitment commitment = Commitment.Finalized)
+        {
+            var res = await RpcClient.GetAccountInfoAsync(accountAddress, commitment);
+            if (!res.WasSuccessful)
+                return new Solana.Unity.Programs.Models.AccountResultWrapper<Registry>(res);
+            var resultingAccount = Registry.Deserialize(Convert.FromBase64String(res.Result.Value.Data[0]));
+            return new Solana.Unity.Programs.Models.AccountResultWrapper<Registry>(res, resultingAccount);
+        }
+
+        public async Task<Solana.Unity.Programs.Models.AccountResultWrapper<SessionToken>> GetSessionTokenAsync(string accountAddress, Commitment commitment = Commitment.Finalized)
+        {
+            var res = await RpcClient.GetAccountInfoAsync(accountAddress, commitment);
+            if (!res.WasSuccessful)
+                return new Solana.Unity.Programs.Models.AccountResultWrapper<SessionToken>(res);
+            var resultingAccount = SessionToken.Deserialize(Convert.FromBase64String(res.Result.Value.Data[0]));
+            return new Solana.Unity.Programs.Models.AccountResultWrapper<SessionToken>(res, resultingAccount);
+        }
+
+        public async Task<Solana.Unity.Programs.Models.AccountResultWrapper<World.Accounts.World>> GetWorldAsync(string accountAddress, Commitment commitment = Commitment.Finalized)
+        {
+            var res = await RpcClient.GetAccountInfoAsync(accountAddress, commitment);
+            if (!res.WasSuccessful)
+                return new Solana.Unity.Programs.Models.AccountResultWrapper<World.Accounts.World>(res);
+            var resultingAccount = World.Accounts.World.Deserialize(Convert.FromBase64String(res.Result.Value.Data[0]));
+            return new Solana.Unity.Programs.Models.AccountResultWrapper<World.Accounts.World>(res, resultingAccount);
+        }
+
+        public async Task<SubscriptionState> SubscribeEntityAsync(string accountAddress, Action<SubscriptionState, Solana.Unity.Rpc.Messages.ResponseValue<Solana.Unity.Rpc.Models.AccountInfo>, Entity> callback, Commitment commitment = Commitment.Finalized)
+        {
+            SubscriptionState res = await StreamingRpcClient.SubscribeAccountInfoAsync(accountAddress, (s, e) =>
+            {
+                Entity parsingResult = null;
+                if (e.Value?.Data?.Count > 0)
+                    parsingResult = Entity.Deserialize(Convert.FromBase64String(e.Value.Data[0]));
+                callback(s, e, parsingResult);
+            }, commitment);
+            return res;
+        }
+
+        public async Task<SubscriptionState> SubscribeRegistryAsync(string accountAddress, Action<SubscriptionState, Solana.Unity.Rpc.Messages.ResponseValue<Solana.Unity.Rpc.Models.AccountInfo>, Registry> callback, Commitment commitment = Commitment.Finalized)
+        {
+            SubscriptionState res = await StreamingRpcClient.SubscribeAccountInfoAsync(accountAddress, (s, e) =>
+            {
+                Registry parsingResult = null;
+                if (e.Value?.Data?.Count > 0)
+                    parsingResult = Registry.Deserialize(Convert.FromBase64String(e.Value.Data[0]));
+                callback(s, e, parsingResult);
+            }, commitment);
+            return res;
+        }
+
+        public async Task<SubscriptionState> SubscribeSessionTokenAsync(string accountAddress, Action<SubscriptionState, Solana.Unity.Rpc.Messages.ResponseValue<Solana.Unity.Rpc.Models.AccountInfo>, SessionToken> callback, Commitment commitment = Commitment.Finalized)
+        {
+            SubscriptionState res = await StreamingRpcClient.SubscribeAccountInfoAsync(accountAddress, (s, e) =>
+            {
+                SessionToken parsingResult = null;
+                if (e.Value?.Data?.Count > 0)
+                    parsingResult = SessionToken.Deserialize(Convert.FromBase64String(e.Value.Data[0]));
+                callback(s, e, parsingResult);
+            }, commitment);
+            return res;
+        }
+
+        public async Task<SubscriptionState> SubscribeWorldAsync(string accountAddress, Action<SubscriptionState, Solana.Unity.Rpc.Messages.ResponseValue<Solana.Unity.Rpc.Models.AccountInfo>, World.Accounts.World> callback, Commitment commitment = Commitment.Finalized)
+        {
+            SubscriptionState res = await StreamingRpcClient.SubscribeAccountInfoAsync(accountAddress, (s, e) =>
+            {
+                World.Accounts.World parsingResult = null;
+                if (e.Value?.Data?.Count > 0)
+                    parsingResult = World.Accounts.World.Deserialize(Convert.FromBase64String(e.Value.Data[0]));
+                callback(s, e, parsingResult);
+            }, commitment);
+            return res;
+        }
+
+        protected override Dictionary<uint, ProgramError<WorldErrorKind>> BuildErrorsDictionary()
+        {
+            return new Dictionary<uint, ProgramError<WorldErrorKind>>{{6000U, new ProgramError<WorldErrorKind>(WorldErrorKind.InvalidAuthority, "Invalid authority for instruction")}, {6001U, new ProgramError<WorldErrorKind>(WorldErrorKind.InvalidSystemOutput, "Invalid system output")}, {6002U, new ProgramError<WorldErrorKind>(WorldErrorKind.WorldAccountMismatch, "The provided world account does not match the expected PDA.")}, {6003U, new ProgramError<WorldErrorKind>(WorldErrorKind.TooManyAuthorities, "Exceed the maximum number of authorities.")}, {6004U, new ProgramError<WorldErrorKind>(WorldErrorKind.AuthorityNotFound, "The provided authority not found")}, {6005U, new ProgramError<WorldErrorKind>(WorldErrorKind.SystemNotApproved, "The system is not approved in this world instance")}, {6006U, new ProgramError<WorldErrorKind>(WorldErrorKind.InvalidComponentOwner, "The component owner does not match the program")}, };
+        }
+    }
+
+    namespace Program
+    {
+        public class AddAuthorityAccounts
+        {
+            public PublicKey Authority { get; set; }
+
+            public PublicKey NewAuthority { get; set; }
+
+            public PublicKey World { get; set; }
+
+            public PublicKey SystemProgram { get; set; } = new PublicKey("11111111111111111111111111111111");
+        }
+
+        public class AddEntityAccounts
+        {
+            public PublicKey Payer { get; set; }
+
+            public PublicKey Entity { get; set; }
+
+            public PublicKey World { get; set; }
+
+            public PublicKey SystemProgram { get; set; } = new PublicKey("11111111111111111111111111111111");
+        }
+
+        public class ApplyAccounts
+        {
+            public PublicKey Buffer { get; set; }
+
+            public PublicKey BoltSystem { get; set; }
+
+            public PublicKey Authority { get; set; }
+
+            public PublicKey CpiAuth { get; set; }
+
+            public PublicKey World { get; set; }
+
+            public PublicKey SystemProgram { get; set; } = new PublicKey("11111111111111111111111111111111");
+        }
+
+        public class ApplyWithSessionAccounts
+        {
+            public PublicKey Buffer { get; set; }
+
+            public PublicKey BoltSystem { get; set; }
+
+            public PublicKey Authority { get; set; }
+
+            public PublicKey CpiAuth { get; set; }
+
+            public PublicKey World { get; set; }
+
+            public PublicKey SessionToken { get; set; }
+
+            public PublicKey SystemProgram { get; set; } = new PublicKey("11111111111111111111111111111111");
+        }
+
+        public class ApproveSystemAccounts
+        {
+            public PublicKey Authority { get; set; }
+
+            public PublicKey World { get; set; }
+
+            public PublicKey System { get; set; }
+
+            public PublicKey SystemProgram { get; set; } = new PublicKey("11111111111111111111111111111111");
+        }
+
+        public class DestroyComponentAccounts
+        {
+            public PublicKey Authority { get; set; }
+
+            public PublicKey Receiver { get; set; }
+
+            public PublicKey ComponentProgram { get; set; }
+
+            public PublicKey ComponentProgramData { get; set; }
+
+            public PublicKey Entity { get; set; }
+
+            public PublicKey Component { get; set; }
+
+            public PublicKey CpiAuth { get; set; }
+
+            public PublicKey SystemProgram { get; set; } = new PublicKey("11111111111111111111111111111111");
+        }
+
+        public class InitializeComponentAccounts
+        {
+            public PublicKey Payer { get; set; }
+
+            public PublicKey Data { get; set; }
+
+            public PublicKey Entity { get; set; }
+
+            public PublicKey ComponentProgram { get; set; }
+
+            public PublicKey Authority { get; set; }
+
+            public PublicKey CpiAuth { get; set; }
+
+            public PublicKey SystemProgram { get; set; } = new PublicKey("11111111111111111111111111111111");
+        }
+
+        public class InitializeNewWorldAccounts
+        {
+            public PublicKey Payer { get; set; }
+
+            public PublicKey World { get; set; }
+
+            public PublicKey Registry { get; set; }
+
+            public PublicKey SystemProgram { get; set; } = new PublicKey("11111111111111111111111111111111");
+        }
+
+        public class InitializeRegistryAccounts
+        {
+            public PublicKey Registry { get; set; }
+
+            public PublicKey Payer { get; set; }
+
+            public PublicKey SystemProgram { get; set; } = new PublicKey("11111111111111111111111111111111");
+        }
+
+        public class RemoveAuthorityAccounts
+        {
+            public PublicKey Authority { get; set; }
+
+            public PublicKey AuthorityToDelete { get; set; }
+
+            public PublicKey World { get; set; }
+
+            public PublicKey SystemProgram { get; set; } = new PublicKey("11111111111111111111111111111111");
+        }
+
+        public class RemoveSystemAccounts
+        {
+            public PublicKey Authority { get; set; }
+
+            public PublicKey World { get; set; }
+
+            public PublicKey System { get; set; }
+
+            public PublicKey SystemProgram { get; set; } = new PublicKey("11111111111111111111111111111111");
+        }
+
+        public partial class WorldProgram
+        {
+            public const string ID = "WorLD15A7CrDwLcLy4fRqtaTb9fbd8o8iqiEMUDse2n";
+            public static Solana.Unity.Rpc.Models.TransactionInstruction AddAuthority(AddAuthorityAccounts accounts, ulong world_id, PublicKey programId = null)
+            {
+                programId ??= new(ID);
+                List<Solana.Unity.Rpc.Models.AccountMeta> keys = new()
+                {Solana.Unity.Rpc.Models.AccountMeta.Writable(accounts.Authority, true), Solana.Unity.Rpc.Models.AccountMeta.ReadOnly(accounts.NewAuthority, false), Solana.Unity.Rpc.Models.AccountMeta.Writable(accounts.World, false), Solana.Unity.Rpc.Models.AccountMeta.ReadOnly(accounts.SystemProgram, false)};
+                byte[] _data = new byte[1200];
+                int offset = 0;
+                _data.WriteU64(13217455069452700133UL, offset);
+                offset += 8;
+                _data.WriteU64(world_id, offset);
+                offset += 8;
+                byte[] resultData = new byte[offset];
+                Array.Copy(_data, resultData, offset);
+                return new Solana.Unity.Rpc.Models.TransactionInstruction{Keys = keys, ProgramId = programId.KeyBytes, Data = resultData};
+            }
+
+            public static Solana.Unity.Rpc.Models.TransactionInstruction AddEntity(AddEntityAccounts accounts, byte[] extra_seed, PublicKey programId = null)
+            {
+                programId ??= new(ID);
+                List<Solana.Unity.Rpc.Models.AccountMeta> keys = new()
+                {Solana.Unity.Rpc.Models.AccountMeta.Writable(accounts.Payer, true), Solana.Unity.Rpc.Models.AccountMeta.Writable(accounts.Entity, false), Solana.Unity.Rpc.Models.AccountMeta.Writable(accounts.World, false), Solana.Unity.Rpc.Models.AccountMeta.ReadOnly(accounts.SystemProgram, false)};
+                byte[] _data = new byte[1200];
+                int offset = 0;
+                _data.WriteU64(4121062988444201379UL, offset);
+                offset += 8;
+                if (extra_seed != null)
+                {
+                    _data.WriteU8(1, offset);
+                    offset += 1;
+                    _data.WriteS32(extra_seed.Length, offset);
+                    offset += 4;
+                    _data.WriteSpan(extra_seed, offset);
+                    offset += extra_seed.Length;
+                }
+                else
+                {
+                    _data.WriteU8(0, offset);
+                    offset += 1;
+                }
+
+                byte[] resultData = new byte[offset];
+                Array.Copy(_data, resultData, offset);
+                return new Solana.Unity.Rpc.Models.TransactionInstruction{Keys = keys, ProgramId = programId.KeyBytes, Data = resultData};
+            }
+
+            public static Solana.Unity.Rpc.Models.TransactionInstruction Apply(ApplyAccounts accounts, byte[] args, PublicKey programId = null)
+            {
+                programId ??= new(ID);
+                List<Solana.Unity.Rpc.Models.AccountMeta> keys = new()
+                {Solana.Unity.Rpc.Models.AccountMeta.Writable(accounts.Buffer, false), Solana.Unity.Rpc.Models.AccountMeta.ReadOnly(accounts.BoltSystem, false), Solana.Unity.Rpc.Models.AccountMeta.ReadOnly(accounts.Authority, true), Solana.Unity.Rpc.Models.AccountMeta.ReadOnly(accounts.CpiAuth, false), Solana.Unity.Rpc.Models.AccountMeta.ReadOnly(accounts.World, false), Solana.Unity.Rpc.Models.AccountMeta.ReadOnly(accounts.SystemProgram, false)};
+                byte[] _data = new byte[1200];
+                int offset = 0;
+                _data.WriteU64(16258613031726085112UL, offset);
+                offset += 8;
+                _data.WriteS32(args.Length, offset);
+                offset += 4;
+                _data.WriteSpan(args, offset);
+                offset += args.Length;
+                byte[] resultData = new byte[offset];
+                Array.Copy(_data, resultData, offset);
+                return new Solana.Unity.Rpc.Models.TransactionInstruction{Keys = keys, ProgramId = programId.KeyBytes, Data = resultData};
+            }
+
+            public static Solana.Unity.Rpc.Models.TransactionInstruction ApplyWithSession(ApplyWithSessionAccounts accounts, byte[] args, PublicKey programId = null)
+            {
+                programId ??= new(ID);
+                List<Solana.Unity.Rpc.Models.AccountMeta> keys = new()
+                {Solana.Unity.Rpc.Models.AccountMeta.Writable(accounts.Buffer, false), Solana.Unity.Rpc.Models.AccountMeta.ReadOnly(accounts.BoltSystem, false), Solana.Unity.Rpc.Models.AccountMeta.ReadOnly(accounts.Authority, true), Solana.Unity.Rpc.Models.AccountMeta.ReadOnly(accounts.CpiAuth, false), Solana.Unity.Rpc.Models.AccountMeta.ReadOnly(accounts.World, false), Solana.Unity.Rpc.Models.AccountMeta.ReadOnly(accounts.SessionToken, false), Solana.Unity.Rpc.Models.AccountMeta.ReadOnly(accounts.SystemProgram, false)};
+                byte[] _data = new byte[1200];
+                int offset = 0;
+                _data.WriteU64(7459768094276011477UL, offset);
+                offset += 8;
+                _data.WriteS32(args.Length, offset);
+                offset += 4;
+                _data.WriteSpan(args, offset);
+                offset += args.Length;
+                byte[] resultData = new byte[offset];
+                Array.Copy(_data, resultData, offset);
+                return new Solana.Unity.Rpc.Models.TransactionInstruction{Keys = keys, ProgramId = programId.KeyBytes, Data = resultData};
+            }
+
+            public static Solana.Unity.Rpc.Models.TransactionInstruction ApproveSystem(ApproveSystemAccounts accounts, PublicKey programId = null)
+            {
+                programId ??= new(ID);
+                List<Solana.Unity.Rpc.Models.AccountMeta> keys = new()
+                {Solana.Unity.Rpc.Models.AccountMeta.Writable(accounts.Authority, true), Solana.Unity.Rpc.Models.AccountMeta.Writable(accounts.World, false), Solana.Unity.Rpc.Models.AccountMeta.ReadOnly(accounts.System, false), Solana.Unity.Rpc.Models.AccountMeta.ReadOnly(accounts.SystemProgram, false)};
+                byte[] _data = new byte[1200];
+                int offset = 0;
+                _data.WriteU64(8777308090533520754UL, offset);
+                offset += 8;
+                byte[] resultData = new byte[offset];
+                Array.Copy(_data, resultData, offset);
+                return new Solana.Unity.Rpc.Models.TransactionInstruction{Keys = keys, ProgramId = programId.KeyBytes, Data = resultData};
+            }
+
+            public static Solana.Unity.Rpc.Models.TransactionInstruction DestroyComponent(DestroyComponentAccounts accounts, PublicKey programId = null)
+            {
+                programId ??= new(ID);
+                List<Solana.Unity.Rpc.Models.AccountMeta> keys = new()
+                {Solana.Unity.Rpc.Models.AccountMeta.Writable(accounts.Authority, true), Solana.Unity.Rpc.Models.AccountMeta.Writable(accounts.Receiver, false), Solana.Unity.Rpc.Models.AccountMeta.ReadOnly(accounts.ComponentProgram, false), Solana.Unity.Rpc.Models.AccountMeta.ReadOnly(accounts.ComponentProgramData, false), Solana.Unity.Rpc.Models.AccountMeta.ReadOnly(accounts.Entity, false), Solana.Unity.Rpc.Models.AccountMeta.Writable(accounts.Component, false), Solana.Unity.Rpc.Models.AccountMeta.ReadOnly(accounts.CpiAuth, false), Solana.Unity.Rpc.Models.AccountMeta.ReadOnly(accounts.SystemProgram, false)};
+                byte[] _data = new byte[1200];
+                int offset = 0;
+                _data.WriteU64(5321952129328727336UL, offset);
+                offset += 8;
+                byte[] resultData = new byte[offset];
+                Array.Copy(_data, resultData, offset);
+                return new Solana.Unity.Rpc.Models.TransactionInstruction{Keys = keys, ProgramId = programId.KeyBytes, Data = resultData};
+            }
+
+            public static Solana.Unity.Rpc.Models.TransactionInstruction InitializeComponent(InitializeComponentAccounts accounts, PublicKey programId = null)
+            {
+                programId ??= new(ID);
+                List<Solana.Unity.Rpc.Models.AccountMeta> keys = new()
+                {Solana.Unity.Rpc.Models.AccountMeta.Writable(accounts.Payer, true), Solana.Unity.Rpc.Models.AccountMeta.Writable(accounts.Data, false), Solana.Unity.Rpc.Models.AccountMeta.ReadOnly(accounts.Entity, false), Solana.Unity.Rpc.Models.AccountMeta.ReadOnly(accounts.ComponentProgram, false), Solana.Unity.Rpc.Models.AccountMeta.ReadOnly(accounts.Authority, false), Solana.Unity.Rpc.Models.AccountMeta.ReadOnly(accounts.CpiAuth, false), Solana.Unity.Rpc.Models.AccountMeta.ReadOnly(accounts.SystemProgram, false)};
+                byte[] _data = new byte[1200];
+                int offset = 0;
+                _data.WriteU64(2179155133888827172UL, offset);
+                offset += 8;
+                byte[] resultData = new byte[offset];
+                Array.Copy(_data, resultData, offset);
+                return new Solana.Unity.Rpc.Models.TransactionInstruction{Keys = keys, ProgramId = programId.KeyBytes, Data = resultData};
+            }
+
+            public static Solana.Unity.Rpc.Models.TransactionInstruction InitializeNewWorld(InitializeNewWorldAccounts accounts, PublicKey programId = null)
+            {
+                programId ??= new(ID);
+                List<Solana.Unity.Rpc.Models.AccountMeta> keys = new()
+                {Solana.Unity.Rpc.Models.AccountMeta.Writable(accounts.Payer, true), Solana.Unity.Rpc.Models.AccountMeta.Writable(accounts.World, false), Solana.Unity.Rpc.Models.AccountMeta.Writable(accounts.Registry, false), Solana.Unity.Rpc.Models.AccountMeta.ReadOnly(accounts.SystemProgram, false)};
+                byte[] _data = new byte[1200];
+                int offset = 0;
+                _data.WriteU64(7118163274173538327UL, offset);
+                offset += 8;
+                byte[] resultData = new byte[offset];
+                Array.Copy(_data, resultData, offset);
+                return new Solana.Unity.Rpc.Models.TransactionInstruction{Keys = keys, ProgramId = programId.KeyBytes, Data = resultData};
+            }
+
+            public static Solana.Unity.Rpc.Models.TransactionInstruction InitializeRegistry(InitializeRegistryAccounts accounts, PublicKey programId = null)
+            {
+                programId ??= new(ID);
+                List<Solana.Unity.Rpc.Models.AccountMeta> keys = new()
+                {Solana.Unity.Rpc.Models.AccountMeta.Writable(accounts.Registry, false), Solana.Unity.Rpc.Models.AccountMeta.Writable(accounts.Payer, true), Solana.Unity.Rpc.Models.AccountMeta.ReadOnly(accounts.SystemProgram, false)};
+                byte[] _data = new byte[1200];
+                int offset = 0;
+                _data.WriteU64(4321548737212364221UL, offset);
+                offset += 8;
+                byte[] resultData = new byte[offset];
+                Array.Copy(_data, resultData, offset);
+                return new Solana.Unity.Rpc.Models.TransactionInstruction{Keys = keys, ProgramId = programId.KeyBytes, Data = resultData};
+            }
+
+            public static Solana.Unity.Rpc.Models.TransactionInstruction RemoveAuthority(RemoveAuthorityAccounts accounts, ulong world_id, PublicKey programId = null)
+            {
+                programId ??= new(ID);
+                List<Solana.Unity.Rpc.Models.AccountMeta> keys = new()
+                {Solana.Unity.Rpc.Models.AccountMeta.Writable(accounts.Authority, true), Solana.Unity.Rpc.Models.AccountMeta.ReadOnly(accounts.AuthorityToDelete, false), Solana.Unity.Rpc.Models.AccountMeta.Writable(accounts.World, false), Solana.Unity.Rpc.Models.AccountMeta.ReadOnly(accounts.SystemProgram, false)};
+                byte[] _data = new byte[1200];
+                int offset = 0;
+                _data.WriteU64(15585545156648003826UL, offset);
+                offset += 8;
+                _data.WriteU64(world_id, offset);
+                offset += 8;
+                byte[] resultData = new byte[offset];
+                Array.Copy(_data, resultData, offset);
+                return new Solana.Unity.Rpc.Models.TransactionInstruction{Keys = keys, ProgramId = programId.KeyBytes, Data = resultData};
+            }
+
+            public static Solana.Unity.Rpc.Models.TransactionInstruction RemoveSystem(RemoveSystemAccounts accounts, PublicKey programId = null)
+            {
+                programId ??= new(ID);
+                List<Solana.Unity.Rpc.Models.AccountMeta> keys = new()
+                {Solana.Unity.Rpc.Models.AccountMeta.Writable(accounts.Authority, true), Solana.Unity.Rpc.Models.AccountMeta.Writable(accounts.World, false), Solana.Unity.Rpc.Models.AccountMeta.ReadOnly(accounts.System, false), Solana.Unity.Rpc.Models.AccountMeta.ReadOnly(accounts.SystemProgram, false)};
+                byte[] _data = new byte[1200];
+                int offset = 0;
+                _data.WriteU64(8688994685429436634UL, offset);
+                offset += 8;
+                byte[] resultData = new byte[offset];
+                Array.Copy(_data, resultData, offset);
+                return new Solana.Unity.Rpc.Models.TransactionInstruction{Keys = keys, ProgramId = programId.KeyBytes, Data = resultData};
+            }
+        }
+    }
 }
 }

+ 14 - 0
clients/csharp/Solana.Unity.Bolt/WorldProgram/World.cs

@@ -15,6 +15,8 @@ namespace World
     {
     {
         public partial class WorldProgram
         public partial class WorldProgram
         {
         {
+            public static readonly PublicKey CPI_AUTH_ADDRESS = new("B2f2y3QTBv346wE6nWKor72AUhUvFF6mPk7TWCF2QVhi");
+
             public static Solana.Unity.Rpc.Models.TransactionInstruction AddEntity(AddEntityAccounts accounts, PublicKey programId = null)
             public static Solana.Unity.Rpc.Models.TransactionInstruction AddEntity(AddEntityAccounts accounts, PublicKey programId = null)
             {
             {
                 programId ??= new(ID);
                 programId ??= new(ID);
@@ -27,6 +29,14 @@ namespace World
                 return AddEntity(accounts, System.Text.Encoding.UTF8.GetBytes(extraSeed), programId);
                 return AddEntity(accounts, System.Text.Encoding.UTF8.GetBytes(extraSeed), programId);
             }
             }
 
 
+            public static PublicKey FindBufferPda() {
+                PublicKey.TryFindProgramAddress(new[]
+                {
+                    Encoding.UTF8.GetBytes("buffer"),
+                }, new PublicKey(ID), out var pda, out _);
+                return pda;
+            }
+
             public static PublicKey FindSessionTokenPda(PublicKey sessionSigner, PublicKey authority)
             public static PublicKey FindSessionTokenPda(PublicKey sessionSigner, PublicKey authority)
             {
             {
                 PublicKey.TryFindProgramAddress(new[]
                 PublicKey.TryFindProgramAddress(new[]
@@ -223,6 +233,8 @@ namespace World
                 Solana.Unity.Rpc.Models.TransactionInstruction instruction;
                 Solana.Unity.Rpc.Models.TransactionInstruction instruction;
                 if (sessionToken != null) {
                 if (sessionToken != null) {
                     var apply = new ApplyWithSessionAccounts() {
                     var apply = new ApplyWithSessionAccounts() {
+                        CpiAuth = CPI_AUTH_ADDRESS,
+                        Buffer = FindBufferPda(),
                         BoltSystem = system,
                         BoltSystem = system,
                         Authority = authority,
                         Authority = authority,
                         World = world,
                         World = world,
@@ -231,6 +243,8 @@ namespace World
                     instruction = ApplyWithSession(apply, args, programId);
                     instruction = ApplyWithSession(apply, args, programId);
                 } else {
                 } else {
                     var apply = new ApplyAccounts() {
                     var apply = new ApplyAccounts() {
+                        CpiAuth = CPI_AUTH_ADDRESS,
+                        Buffer = FindBufferPda(),
                         BoltSystem = system,
                         BoltSystem = system,
                         Authority = authority,
                         Authority = authority,
                         World = world,
                         World = world,

+ 0 - 74
crates/bolt-lang/attribute/bolt-program/src/lib.rs

@@ -44,8 +44,6 @@ pub fn bolt_program(args: TokenStream, input: TokenStream) -> TokenStream {
 fn modify_component_module(mut module: ItemMod, component_type: &Type) -> ItemMod {
 fn modify_component_module(mut module: ItemMod, component_type: &Type) -> ItemMod {
     let (initialize_fn, initialize_struct) = generate_initialize(component_type);
     let (initialize_fn, initialize_struct) = generate_initialize(component_type);
     let (destroy_fn, destroy_struct) = generate_destroy(component_type);
     let (destroy_fn, destroy_struct) = generate_destroy(component_type);
-    let (update_fn, update_with_session_fn, update_struct, update_with_session_struct) =
-        generate_update(component_type);
     let set_owner = bolt_utils::instructions::generate_set_owner();
     let set_owner = bolt_utils::instructions::generate_set_owner();
     let set_data = bolt_utils::instructions::generate_set_data();
     let set_data = bolt_utils::instructions::generate_set_data();
     module.content = module.content.map(|(brace, mut items)| {
     module.content = module.content.map(|(brace, mut items)| {
@@ -53,10 +51,6 @@ fn modify_component_module(mut module: ItemMod, component_type: &Type) -> ItemMo
             vec![
             vec![
                 initialize_fn,
                 initialize_fn,
                 initialize_struct,
                 initialize_struct,
-                update_fn,
-                update_struct,
-                update_with_session_fn,
-                update_with_session_struct,
                 destroy_fn,
                 destroy_fn,
                 destroy_struct,
                 destroy_struct,
                 set_owner.function,
                 set_owner.function,
@@ -210,74 +204,6 @@ fn generate_initialize(component_type: &Type) -> (TokenStream2, TokenStream2) {
     )
     )
 }
 }
 
 
-// TODO: Remove this. We are directly writing to the account.
-/// Generates the instructions and related structs to inject in the component.
-fn generate_update(
-    component_type: &Type,
-) -> (TokenStream2, TokenStream2, TokenStream2, TokenStream2) {
-    (
-        quote! {
-            #[automatically_derived]
-            pub fn update(ctx: Context<Update>, data: Vec<u8>) -> Result<()> {
-                require!(ctx.accounts.bolt_component.bolt_metadata.authority == World::id() || (ctx.accounts.bolt_component.bolt_metadata.authority == *ctx.accounts.authority.key && ctx.accounts.authority.is_signer), BoltError::InvalidAuthority);
-
-                bolt_lang::cpi::checker(&ctx.accounts.cpi_auth.to_account_info())?;
-
-                ctx.accounts.bolt_component.set_inner(<#component_type>::try_from_slice(&data)?);
-                Ok(())
-            }
-        },
-        quote! {
-            #[automatically_derived]
-            pub fn update_with_session(ctx: Context<UpdateWithSession>, data: Vec<u8>) -> Result<()> {
-                if ctx.accounts.bolt_component.bolt_metadata.authority == World::id() {
-                    require!(Clock::get()?.unix_timestamp < ctx.accounts.session_token.valid_until, bolt_lang::session_keys::SessionError::InvalidToken);
-                } else {
-                    let validity_ctx = bolt_lang::session_keys::ValidityChecker {
-                        session_token: ctx.accounts.session_token.clone(),
-                        session_signer: ctx.accounts.authority.clone(),
-                        authority: ctx.accounts.bolt_component.bolt_metadata.authority.clone(),
-                        target_program: World::id(),
-                    };
-                    require!(ctx.accounts.session_token.validate(validity_ctx)?, bolt_lang::session_keys::SessionError::InvalidToken);
-                    require_eq!(ctx.accounts.bolt_component.bolt_metadata.authority, ctx.accounts.session_token.authority, bolt_lang::session_keys::SessionError::InvalidToken);
-                }
-
-                bolt_lang::cpi::checker(&ctx.accounts.cpi_auth.to_account_info())?;
-
-                ctx.accounts.bolt_component.set_inner(<#component_type>::try_from_slice(&data)?);
-                Ok(())
-            }
-        },
-        quote! {
-            #[automatically_derived]
-            #[derive(Accounts)]
-            pub struct Update<'info> {
-                #[account()]
-                pub cpi_auth: Signer<'info>,
-                #[account(mut)]
-                pub bolt_component: Account<'info, #component_type>,
-                #[account()]
-                pub authority: Signer<'info>,
-            }
-        },
-        quote! {
-            #[automatically_derived]
-            #[derive(Accounts)]
-            pub struct UpdateWithSession<'info> {
-                #[account()]
-                pub cpi_auth: Signer<'info>,
-                #[account(mut)]
-                pub bolt_component: Account<'info, #component_type>,
-                #[account()]
-                pub authority: Signer<'info>,
-                #[account(constraint = session_token.to_account_info().owner == &bolt_lang::session_keys::ID)]
-                pub session_token: Account<'info, bolt_lang::session_keys::SessionToken>,
-            }
-        },
-    )
-}
-
 /// Checks if the field is expecting a program.
 /// Checks if the field is expecting a program.
 fn is_expecting_program(field: &Field) -> bool {
 fn is_expecting_program(field: &Field) -> bool {
     field.ty.to_token_stream().to_string().contains("Program")
     field.ty.to_token_stream().to_string().contains("Program")