Generated.cs 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568
  1. #pragma warning disable CS1591
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Numerics;
  6. using System.Threading.Tasks;
  7. using Solana.Unity;
  8. using Solana.Unity.Programs.Abstract;
  9. using Solana.Unity.Programs.Utilities;
  10. using Solana.Unity.Rpc;
  11. using Solana.Unity.Rpc.Builders;
  12. using Solana.Unity.Rpc.Core.Http;
  13. using Solana.Unity.Rpc.Core.Sockets;
  14. using Solana.Unity.Rpc.Types;
  15. using Solana.Unity.Wallet;
  16. using World;
  17. using World.Program;
  18. using World.Errors;
  19. using World.Accounts;
  20. using World.Types;
  21. namespace World
  22. {
  23. namespace Accounts
  24. {
  25. public partial class Entity
  26. {
  27. public static ulong ACCOUNT_DISCRIMINATOR => 1751670451238706478UL;
  28. public static ReadOnlySpan<byte> ACCOUNT_DISCRIMINATOR_BYTES => new byte[]{46, 157, 161, 161, 254, 46, 79, 24};
  29. public static string ACCOUNT_DISCRIMINATOR_B58 => "8oEQa6zH67R";
  30. public ulong Id { get; set; }
  31. public static Entity Deserialize(ReadOnlySpan<byte> _data)
  32. {
  33. int offset = 0;
  34. ulong accountHashValue = _data.GetU64(offset);
  35. offset += 8;
  36. if (accountHashValue != ACCOUNT_DISCRIMINATOR)
  37. {
  38. return null;
  39. }
  40. Entity result = new Entity();
  41. result.Id = _data.GetU64(offset);
  42. offset += 8;
  43. return result;
  44. }
  45. }
  46. public partial class Registry
  47. {
  48. public static ulong ACCOUNT_DISCRIMINATOR => 15779688099924061743UL;
  49. public static ReadOnlySpan<byte> ACCOUNT_DISCRIMINATOR_BYTES => new byte[]{47, 174, 110, 246, 184, 182, 252, 218};
  50. public static string ACCOUNT_DISCRIMINATOR_B58 => "8ya1XGY4XBP";
  51. public ulong Worlds { get; set; }
  52. public static Registry Deserialize(ReadOnlySpan<byte> _data)
  53. {
  54. int offset = 0;
  55. ulong accountHashValue = _data.GetU64(offset);
  56. offset += 8;
  57. if (accountHashValue != ACCOUNT_DISCRIMINATOR)
  58. {
  59. return null;
  60. }
  61. Registry result = new Registry();
  62. result.Worlds = _data.GetU64(offset);
  63. offset += 8;
  64. return result;
  65. }
  66. }
  67. public partial class World
  68. {
  69. public static ulong ACCOUNT_DISCRIMINATOR => 8978805993381703057UL;
  70. public static ReadOnlySpan<byte> ACCOUNT_DISCRIMINATOR_BYTES => new byte[]{145, 45, 170, 174, 122, 32, 155, 124};
  71. public static string ACCOUNT_DISCRIMINATOR_B58 => "RHQudtaQtu1";
  72. public ulong Id { get; set; }
  73. public ulong Entities { get; set; }
  74. public PublicKey[] Authorities { get; set; }
  75. public bool Permissionless { get; set; }
  76. public byte[] Systems { get; set; }
  77. public static World Deserialize(ReadOnlySpan<byte> _data)
  78. {
  79. int offset = 0;
  80. ulong accountHashValue = _data.GetU64(offset);
  81. offset += 8;
  82. if (accountHashValue != ACCOUNT_DISCRIMINATOR)
  83. {
  84. return null;
  85. }
  86. World result = new World();
  87. result.Id = _data.GetU64(offset);
  88. offset += 8;
  89. result.Entities = _data.GetU64(offset);
  90. offset += 8;
  91. int resultAuthoritiesLength = (int)_data.GetU32(offset);
  92. offset += 4;
  93. result.Authorities = new PublicKey[resultAuthoritiesLength];
  94. for (uint resultAuthoritiesIdx = 0; resultAuthoritiesIdx < resultAuthoritiesLength; resultAuthoritiesIdx++)
  95. {
  96. result.Authorities[resultAuthoritiesIdx] = _data.GetPubKey(offset);
  97. offset += 32;
  98. }
  99. result.Permissionless = _data.GetBool(offset);
  100. offset += 1;
  101. int resultSystemsLength = (int)_data.GetU32(offset);
  102. offset += 4;
  103. result.Systems = _data.GetBytes(offset, resultSystemsLength);
  104. offset += resultSystemsLength;
  105. return result;
  106. }
  107. }
  108. }
  109. namespace Errors
  110. {
  111. public enum WorldErrorKind : uint
  112. {
  113. InvalidAuthority = 6000U,
  114. InvalidSystemOutput = 6001U,
  115. WorldAccountMismatch = 6002U,
  116. TooManyAuthorities = 6003U,
  117. AuthorityNotFound = 6004U,
  118. SystemNotApproved = 6005U
  119. }
  120. }
  121. namespace Types
  122. {
  123. }
  124. public partial class WorldClient : TransactionalBaseClient<WorldErrorKind>
  125. {
  126. public WorldClient(IRpcClient rpcClient, IStreamingRpcClient streamingRpcClient, PublicKey programId = null) : base(rpcClient, streamingRpcClient, programId ?? new PublicKey(WorldProgram.ID))
  127. {
  128. }
  129. public async Task<Solana.Unity.Programs.Models.ProgramAccountsResultWrapper<List<Entity>>> GetEntitysAsync(string programAddress = WorldProgram.ID, Commitment commitment = Commitment.Confirmed)
  130. {
  131. var list = new List<Solana.Unity.Rpc.Models.MemCmp>{new Solana.Unity.Rpc.Models.MemCmp{Bytes = Entity.ACCOUNT_DISCRIMINATOR_B58, Offset = 0}};
  132. var res = await RpcClient.GetProgramAccountsAsync(programAddress, commitment, memCmpList: list);
  133. if (!res.WasSuccessful || !(res.Result?.Count > 0))
  134. return new Solana.Unity.Programs.Models.ProgramAccountsResultWrapper<List<Entity>>(res);
  135. List<Entity> resultingAccounts = new List<Entity>(res.Result.Count);
  136. resultingAccounts.AddRange(res.Result.Select(result => Entity.Deserialize(Convert.FromBase64String(result.Account.Data[0]))));
  137. return new Solana.Unity.Programs.Models.ProgramAccountsResultWrapper<List<Entity>>(res, resultingAccounts);
  138. }
  139. public async Task<Solana.Unity.Programs.Models.ProgramAccountsResultWrapper<List<Registry>>> GetRegistrysAsync(string programAddress = WorldProgram.ID, Commitment commitment = Commitment.Confirmed)
  140. {
  141. var list = new List<Solana.Unity.Rpc.Models.MemCmp>{new Solana.Unity.Rpc.Models.MemCmp{Bytes = Registry.ACCOUNT_DISCRIMINATOR_B58, Offset = 0}};
  142. var res = await RpcClient.GetProgramAccountsAsync(programAddress, commitment, memCmpList: list);
  143. if (!res.WasSuccessful || !(res.Result?.Count > 0))
  144. return new Solana.Unity.Programs.Models.ProgramAccountsResultWrapper<List<Registry>>(res);
  145. List<Registry> resultingAccounts = new List<Registry>(res.Result.Count);
  146. resultingAccounts.AddRange(res.Result.Select(result => Registry.Deserialize(Convert.FromBase64String(result.Account.Data[0]))));
  147. return new Solana.Unity.Programs.Models.ProgramAccountsResultWrapper<List<Registry>>(res, resultingAccounts);
  148. }
  149. public async Task<Solana.Unity.Programs.Models.ProgramAccountsResultWrapper<List<World.Accounts.World>>> GetWorldsAsync(string programAddress = WorldProgram.ID, Commitment commitment = Commitment.Confirmed)
  150. {
  151. var list = new List<Solana.Unity.Rpc.Models.MemCmp>{new Solana.Unity.Rpc.Models.MemCmp{Bytes = World.Accounts.World.ACCOUNT_DISCRIMINATOR_B58, Offset = 0}};
  152. var res = await RpcClient.GetProgramAccountsAsync(programAddress, commitment, memCmpList: list);
  153. if (!res.WasSuccessful || !(res.Result?.Count > 0))
  154. return new Solana.Unity.Programs.Models.ProgramAccountsResultWrapper<List<World.Accounts.World>>(res);
  155. List<World.Accounts.World> resultingAccounts = new List<World.Accounts.World>(res.Result.Count);
  156. resultingAccounts.AddRange(res.Result.Select(result => World.Accounts.World.Deserialize(Convert.FromBase64String(result.Account.Data[0]))));
  157. return new Solana.Unity.Programs.Models.ProgramAccountsResultWrapper<List<World.Accounts.World>>(res, resultingAccounts);
  158. }
  159. public async Task<Solana.Unity.Programs.Models.AccountResultWrapper<Entity>> GetEntityAsync(string accountAddress, Commitment commitment = Commitment.Finalized)
  160. {
  161. var res = await RpcClient.GetAccountInfoAsync(accountAddress, commitment);
  162. if (!res.WasSuccessful)
  163. return new Solana.Unity.Programs.Models.AccountResultWrapper<Entity>(res);
  164. var resultingAccount = Entity.Deserialize(Convert.FromBase64String(res.Result.Value.Data[0]));
  165. return new Solana.Unity.Programs.Models.AccountResultWrapper<Entity>(res, resultingAccount);
  166. }
  167. public async Task<Solana.Unity.Programs.Models.AccountResultWrapper<Registry>> GetRegistryAsync(string accountAddress, Commitment commitment = Commitment.Finalized)
  168. {
  169. var res = await RpcClient.GetAccountInfoAsync(accountAddress, commitment);
  170. if (!res.WasSuccessful)
  171. return new Solana.Unity.Programs.Models.AccountResultWrapper<Registry>(res);
  172. var resultingAccount = Registry.Deserialize(Convert.FromBase64String(res.Result.Value.Data[0]));
  173. return new Solana.Unity.Programs.Models.AccountResultWrapper<Registry>(res, resultingAccount);
  174. }
  175. public async Task<Solana.Unity.Programs.Models.AccountResultWrapper<World.Accounts.World>> GetWorldAsync(string accountAddress, Commitment commitment = Commitment.Finalized)
  176. {
  177. var res = await RpcClient.GetAccountInfoAsync(accountAddress, commitment);
  178. if (!res.WasSuccessful)
  179. return new Solana.Unity.Programs.Models.AccountResultWrapper<World.Accounts.World>(res);
  180. var resultingAccount = World.Accounts.World.Deserialize(Convert.FromBase64String(res.Result.Value.Data[0]));
  181. return new Solana.Unity.Programs.Models.AccountResultWrapper<World.Accounts.World>(res, resultingAccount);
  182. }
  183. 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)
  184. {
  185. SubscriptionState res = await StreamingRpcClient.SubscribeAccountInfoAsync(accountAddress, (s, e) =>
  186. {
  187. Entity parsingResult = null;
  188. if (e.Value?.Data?.Count > 0)
  189. parsingResult = Entity.Deserialize(Convert.FromBase64String(e.Value.Data[0]));
  190. callback(s, e, parsingResult);
  191. }, commitment);
  192. return res;
  193. }
  194. 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)
  195. {
  196. SubscriptionState res = await StreamingRpcClient.SubscribeAccountInfoAsync(accountAddress, (s, e) =>
  197. {
  198. Registry parsingResult = null;
  199. if (e.Value?.Data?.Count > 0)
  200. parsingResult = Registry.Deserialize(Convert.FromBase64String(e.Value.Data[0]));
  201. callback(s, e, parsingResult);
  202. }, commitment);
  203. return res;
  204. }
  205. 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)
  206. {
  207. SubscriptionState res = await StreamingRpcClient.SubscribeAccountInfoAsync(accountAddress, (s, e) =>
  208. {
  209. World.Accounts.World parsingResult = null;
  210. if (e.Value?.Data?.Count > 0)
  211. parsingResult = World.Accounts.World.Deserialize(Convert.FromBase64String(e.Value.Data[0]));
  212. callback(s, e, parsingResult);
  213. }, commitment);
  214. return res;
  215. }
  216. protected override Dictionary<uint, ProgramError<WorldErrorKind>> BuildErrorsDictionary()
  217. {
  218. 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")}, };
  219. }
  220. }
  221. namespace Program
  222. {
  223. public class AddAuthorityAccounts
  224. {
  225. public PublicKey Authority { get; set; }
  226. public PublicKey NewAuthority { get; set; }
  227. public PublicKey World { get; set; }
  228. public PublicKey SystemProgram { get; set; } = new PublicKey("11111111111111111111111111111111");
  229. }
  230. public class AddEntityAccounts
  231. {
  232. public PublicKey Payer { get; set; }
  233. public PublicKey Entity { get; set; }
  234. public PublicKey World { get; set; }
  235. public PublicKey SystemProgram { get; set; } = new PublicKey("11111111111111111111111111111111");
  236. }
  237. public class ApplyAccounts
  238. {
  239. public PublicKey BoltSystem { get; set; }
  240. public PublicKey Authority { get; set; }
  241. public PublicKey CpiAuth { get; set; } = new PublicKey("B2f2y3QTBv346wE6nWKor72AUhUvFF6mPk7TWCF2QVhi");
  242. public PublicKey World { get; set; }
  243. }
  244. public class ApplyWithSessionAccounts
  245. {
  246. public PublicKey BoltSystem { get; set; }
  247. public PublicKey Authority { get; set; }
  248. public PublicKey CpiAuth { get; set; } = new PublicKey("B2f2y3QTBv346wE6nWKor72AUhUvFF6mPk7TWCF2QVhi");
  249. public PublicKey World { get; set; }
  250. public PublicKey SessionToken { get; set; }
  251. }
  252. public class ApproveSystemAccounts
  253. {
  254. public PublicKey Authority { get; set; }
  255. public PublicKey World { get; set; }
  256. public PublicKey System { get; set; }
  257. public PublicKey SystemProgram { get; set; } = new PublicKey("11111111111111111111111111111111");
  258. }
  259. public class DestroyComponentAccounts
  260. {
  261. public PublicKey Authority { get; set; }
  262. public PublicKey Receiver { get; set; }
  263. public PublicKey ComponentProgram { get; set; }
  264. public PublicKey ComponentProgramData { get; set; }
  265. public PublicKey Entity { get; set; }
  266. public PublicKey Component { get; set; }
  267. public PublicKey CpiAuth { get; set; } = new PublicKey("B2f2y3QTBv346wE6nWKor72AUhUvFF6mPk7TWCF2QVhi");
  268. public PublicKey SystemProgram { get; set; } = new PublicKey("11111111111111111111111111111111");
  269. }
  270. public class InitializeComponentAccounts
  271. {
  272. public PublicKey Payer { get; set; }
  273. public PublicKey Data { get; set; }
  274. public PublicKey Entity { get; set; }
  275. public PublicKey ComponentProgram { get; set; }
  276. public PublicKey Authority { get; set; }
  277. public PublicKey CpiAuth { get; set; } = new PublicKey("B2f2y3QTBv346wE6nWKor72AUhUvFF6mPk7TWCF2QVhi");
  278. public PublicKey SystemProgram { get; set; } = new PublicKey("11111111111111111111111111111111");
  279. }
  280. public class InitializeNewWorldAccounts
  281. {
  282. public PublicKey Payer { get; set; }
  283. public PublicKey World { get; set; }
  284. public PublicKey Registry { get; set; }
  285. public PublicKey SystemProgram { get; set; } = new PublicKey("11111111111111111111111111111111");
  286. }
  287. public class InitializeRegistryAccounts
  288. {
  289. public PublicKey Registry { get; set; }
  290. public PublicKey Payer { get; set; }
  291. public PublicKey SystemProgram { get; set; } = new PublicKey("11111111111111111111111111111111");
  292. }
  293. public class RemoveAuthorityAccounts
  294. {
  295. public PublicKey Authority { get; set; }
  296. public PublicKey AuthorityToDelete { get; set; }
  297. public PublicKey World { get; set; }
  298. public PublicKey SystemProgram { get; set; } = new PublicKey("11111111111111111111111111111111");
  299. }
  300. public class RemoveSystemAccounts
  301. {
  302. public PublicKey Authority { get; set; }
  303. public PublicKey World { get; set; }
  304. public PublicKey System { get; set; }
  305. public PublicKey SystemProgram { get; set; } = new PublicKey("11111111111111111111111111111111");
  306. }
  307. public partial class WorldProgram
  308. {
  309. public const string ID = "WorLD15A7CrDwLcLy4fRqtaTb9fbd8o8iqiEMUDse2n";
  310. public static Solana.Unity.Rpc.Models.TransactionInstruction AddAuthority(AddAuthorityAccounts accounts, ulong world_id, PublicKey programId = null)
  311. {
  312. programId ??= new(ID);
  313. List<Solana.Unity.Rpc.Models.AccountMeta> keys = new()
  314. {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)};
  315. byte[] _data = new byte[1200];
  316. int offset = 0;
  317. _data.WriteU64(13217455069452700133UL, offset);
  318. offset += 8;
  319. _data.WriteU64(world_id, offset);
  320. offset += 8;
  321. byte[] resultData = new byte[offset];
  322. Array.Copy(_data, resultData, offset);
  323. return new Solana.Unity.Rpc.Models.TransactionInstruction{Keys = keys, ProgramId = programId.KeyBytes, Data = resultData};
  324. }
  325. public static Solana.Unity.Rpc.Models.TransactionInstruction AddEntity(AddEntityAccounts accounts, byte[] extra_seed, PublicKey programId = null)
  326. {
  327. programId ??= new(ID);
  328. List<Solana.Unity.Rpc.Models.AccountMeta> keys = new()
  329. {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)};
  330. byte[] _data = new byte[1200];
  331. int offset = 0;
  332. _data.WriteU64(4121062988444201379UL, offset);
  333. offset += 8;
  334. if (extra_seed != null)
  335. {
  336. _data.WriteU8(1, offset);
  337. offset += 1;
  338. _data.WriteS32(extra_seed.Length, offset);
  339. offset += 4;
  340. _data.WriteSpan(extra_seed, offset);
  341. offset += extra_seed.Length;
  342. }
  343. else
  344. {
  345. _data.WriteU8(0, offset);
  346. offset += 1;
  347. }
  348. byte[] resultData = new byte[offset];
  349. Array.Copy(_data, resultData, offset);
  350. return new Solana.Unity.Rpc.Models.TransactionInstruction{Keys = keys, ProgramId = programId.KeyBytes, Data = resultData};
  351. }
  352. public static Solana.Unity.Rpc.Models.TransactionInstruction Apply(ApplyAccounts accounts, byte[] args, PublicKey programId = null)
  353. {
  354. programId ??= new(ID);
  355. List<Solana.Unity.Rpc.Models.AccountMeta> keys = new()
  356. {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)};
  357. byte[] _data = new byte[1200];
  358. int offset = 0;
  359. _data.WriteU64(16258613031726085112UL, offset);
  360. offset += 8;
  361. _data.WriteS32(args.Length, offset);
  362. offset += 4;
  363. _data.WriteSpan(args, offset);
  364. offset += args.Length;
  365. byte[] resultData = new byte[offset];
  366. Array.Copy(_data, resultData, offset);
  367. return new Solana.Unity.Rpc.Models.TransactionInstruction{Keys = keys, ProgramId = programId.KeyBytes, Data = resultData};
  368. }
  369. public static Solana.Unity.Rpc.Models.TransactionInstruction ApplyWithSession(ApplyWithSessionAccounts accounts, byte[] args, PublicKey programId = null)
  370. {
  371. programId ??= new(ID);
  372. List<Solana.Unity.Rpc.Models.AccountMeta> keys = new()
  373. {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)};
  374. byte[] _data = new byte[1200];
  375. int offset = 0;
  376. _data.WriteU64(7459768094276011477UL, offset);
  377. offset += 8;
  378. _data.WriteS32(args.Length, offset);
  379. offset += 4;
  380. _data.WriteSpan(args, offset);
  381. offset += args.Length;
  382. byte[] resultData = new byte[offset];
  383. Array.Copy(_data, resultData, offset);
  384. return new Solana.Unity.Rpc.Models.TransactionInstruction{Keys = keys, ProgramId = programId.KeyBytes, Data = resultData};
  385. }
  386. public static Solana.Unity.Rpc.Models.TransactionInstruction ApproveSystem(ApproveSystemAccounts accounts, PublicKey programId = null)
  387. {
  388. programId ??= new(ID);
  389. List<Solana.Unity.Rpc.Models.AccountMeta> keys = new()
  390. {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)};
  391. byte[] _data = new byte[1200];
  392. int offset = 0;
  393. _data.WriteU64(8777308090533520754UL, offset);
  394. offset += 8;
  395. byte[] resultData = new byte[offset];
  396. Array.Copy(_data, resultData, offset);
  397. return new Solana.Unity.Rpc.Models.TransactionInstruction{Keys = keys, ProgramId = programId.KeyBytes, Data = resultData};
  398. }
  399. public static Solana.Unity.Rpc.Models.TransactionInstruction DestroyComponent(DestroyComponentAccounts accounts, PublicKey programId = null)
  400. {
  401. programId ??= new(ID);
  402. List<Solana.Unity.Rpc.Models.AccountMeta> keys = new()
  403. {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)};
  404. byte[] _data = new byte[1200];
  405. int offset = 0;
  406. _data.WriteU64(5321952129328727336UL, offset);
  407. offset += 8;
  408. byte[] resultData = new byte[offset];
  409. Array.Copy(_data, resultData, offset);
  410. return new Solana.Unity.Rpc.Models.TransactionInstruction{Keys = keys, ProgramId = programId.KeyBytes, Data = resultData};
  411. }
  412. public static Solana.Unity.Rpc.Models.TransactionInstruction InitializeComponent(InitializeComponentAccounts accounts, PublicKey programId = null)
  413. {
  414. programId ??= new(ID);
  415. List<Solana.Unity.Rpc.Models.AccountMeta> keys = new()
  416. {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)};
  417. byte[] _data = new byte[1200];
  418. int offset = 0;
  419. _data.WriteU64(2179155133888827172UL, offset);
  420. offset += 8;
  421. byte[] resultData = new byte[offset];
  422. Array.Copy(_data, resultData, offset);
  423. return new Solana.Unity.Rpc.Models.TransactionInstruction{Keys = keys, ProgramId = programId.KeyBytes, Data = resultData};
  424. }
  425. public static Solana.Unity.Rpc.Models.TransactionInstruction InitializeNewWorld(InitializeNewWorldAccounts accounts, PublicKey programId = null)
  426. {
  427. programId ??= new(ID);
  428. List<Solana.Unity.Rpc.Models.AccountMeta> keys = new()
  429. {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)};
  430. byte[] _data = new byte[1200];
  431. int offset = 0;
  432. _data.WriteU64(7118163274173538327UL, offset);
  433. offset += 8;
  434. byte[] resultData = new byte[offset];
  435. Array.Copy(_data, resultData, offset);
  436. return new Solana.Unity.Rpc.Models.TransactionInstruction{Keys = keys, ProgramId = programId.KeyBytes, Data = resultData};
  437. }
  438. public static Solana.Unity.Rpc.Models.TransactionInstruction InitializeRegistry(InitializeRegistryAccounts accounts, PublicKey programId = null)
  439. {
  440. programId ??= new(ID);
  441. List<Solana.Unity.Rpc.Models.AccountMeta> keys = new()
  442. {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)};
  443. byte[] _data = new byte[1200];
  444. int offset = 0;
  445. _data.WriteU64(4321548737212364221UL, offset);
  446. offset += 8;
  447. byte[] resultData = new byte[offset];
  448. Array.Copy(_data, resultData, offset);
  449. return new Solana.Unity.Rpc.Models.TransactionInstruction{Keys = keys, ProgramId = programId.KeyBytes, Data = resultData};
  450. }
  451. public static Solana.Unity.Rpc.Models.TransactionInstruction RemoveAuthority(RemoveAuthorityAccounts accounts, ulong world_id, PublicKey programId = null)
  452. {
  453. programId ??= new(ID);
  454. List<Solana.Unity.Rpc.Models.AccountMeta> keys = new()
  455. {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)};
  456. byte[] _data = new byte[1200];
  457. int offset = 0;
  458. _data.WriteU64(15585545156648003826UL, offset);
  459. offset += 8;
  460. _data.WriteU64(world_id, offset);
  461. offset += 8;
  462. byte[] resultData = new byte[offset];
  463. Array.Copy(_data, resultData, offset);
  464. return new Solana.Unity.Rpc.Models.TransactionInstruction{Keys = keys, ProgramId = programId.KeyBytes, Data = resultData};
  465. }
  466. public static Solana.Unity.Rpc.Models.TransactionInstruction RemoveSystem(RemoveSystemAccounts accounts, PublicKey programId = null)
  467. {
  468. programId ??= new(ID);
  469. List<Solana.Unity.Rpc.Models.AccountMeta> keys = new()
  470. {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)};
  471. byte[] _data = new byte[1200];
  472. int offset = 0;
  473. _data.WriteU64(8688994685429436634UL, offset);
  474. offset += 8;
  475. byte[] resultData = new byte[offset];
  476. Array.Copy(_data, resultData, offset);
  477. return new Solana.Unity.Rpc.Models.TransactionInstruction{Keys = keys, ProgramId = programId.KeyBytes, Data = resultData};
  478. }
  479. }
  480. }
  481. }