Generated.cs 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651
  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 SessionToken
  68. {
  69. public static ulong ACCOUNT_DISCRIMINATOR => 1081168673100727529UL;
  70. public static ReadOnlySpan<byte> ACCOUNT_DISCRIMINATOR_BYTES => new byte[]{233, 4, 115, 14, 46, 21, 1, 15};
  71. public static string ACCOUNT_DISCRIMINATOR_B58 => "fyZWTdUu1pS";
  72. public PublicKey Authority { get; set; }
  73. public PublicKey TargetProgram { get; set; }
  74. public PublicKey SessionSigner { get; set; }
  75. public long ValidUntil { get; set; }
  76. public static SessionToken Deserialize(ReadOnlySpan<byte> _data)
  77. {
  78. int offset = 0;
  79. ulong accountHashValue = _data.GetU64(offset);
  80. offset += 8;
  81. if (accountHashValue != ACCOUNT_DISCRIMINATOR)
  82. {
  83. return null;
  84. }
  85. SessionToken result = new SessionToken();
  86. result.Authority = _data.GetPubKey(offset);
  87. offset += 32;
  88. result.TargetProgram = _data.GetPubKey(offset);
  89. offset += 32;
  90. result.SessionSigner = _data.GetPubKey(offset);
  91. offset += 32;
  92. result.ValidUntil = _data.GetS64(offset);
  93. offset += 8;
  94. return result;
  95. }
  96. }
  97. public partial class World
  98. {
  99. public static ulong ACCOUNT_DISCRIMINATOR => 8978805993381703057UL;
  100. public static ReadOnlySpan<byte> ACCOUNT_DISCRIMINATOR_BYTES => new byte[]{145, 45, 170, 174, 122, 32, 155, 124};
  101. public static string ACCOUNT_DISCRIMINATOR_B58 => "RHQudtaQtu1";
  102. public ulong Id { get; set; }
  103. public ulong Entities { get; set; }
  104. public PublicKey[] Authorities { get; set; }
  105. public bool Permissionless { get; set; }
  106. public byte[] Systems { get; set; }
  107. public static World Deserialize(ReadOnlySpan<byte> _data)
  108. {
  109. int offset = 0;
  110. ulong accountHashValue = _data.GetU64(offset);
  111. offset += 8;
  112. if (accountHashValue != ACCOUNT_DISCRIMINATOR)
  113. {
  114. return null;
  115. }
  116. World result = new World();
  117. result.Id = _data.GetU64(offset);
  118. offset += 8;
  119. result.Entities = _data.GetU64(offset);
  120. offset += 8;
  121. int resultAuthoritiesLength = (int)_data.GetU32(offset);
  122. offset += 4;
  123. result.Authorities = new PublicKey[resultAuthoritiesLength];
  124. for (uint resultAuthoritiesIdx = 0; resultAuthoritiesIdx < resultAuthoritiesLength; resultAuthoritiesIdx++)
  125. {
  126. result.Authorities[resultAuthoritiesIdx] = _data.GetPubKey(offset);
  127. offset += 32;
  128. }
  129. result.Permissionless = _data.GetBool(offset);
  130. offset += 1;
  131. int resultSystemsLength = (int)_data.GetU32(offset);
  132. offset += 4;
  133. result.Systems = _data.GetBytes(offset, resultSystemsLength);
  134. offset += resultSystemsLength;
  135. return result;
  136. }
  137. }
  138. }
  139. namespace Errors
  140. {
  141. public enum WorldErrorKind : uint
  142. {
  143. InvalidAuthority = 6000U,
  144. InvalidSystemOutput = 6001U,
  145. WorldAccountMismatch = 6002U,
  146. TooManyAuthorities = 6003U,
  147. AuthorityNotFound = 6004U,
  148. SystemNotApproved = 6005U,
  149. InvalidComponentOwner = 6006U
  150. }
  151. }
  152. namespace Types
  153. {
  154. }
  155. public partial class WorldClient : TransactionalBaseClient<WorldErrorKind>
  156. {
  157. public WorldClient(IRpcClient rpcClient, IStreamingRpcClient streamingRpcClient, PublicKey programId = null) : base(rpcClient, streamingRpcClient, programId ?? new PublicKey(WorldProgram.ID))
  158. {
  159. }
  160. public async Task<Solana.Unity.Programs.Models.ProgramAccountsResultWrapper<List<Entity>>> GetEntitysAsync(string programAddress = WorldProgram.ID, Commitment commitment = Commitment.Confirmed)
  161. {
  162. var list = new List<Solana.Unity.Rpc.Models.MemCmp>{new Solana.Unity.Rpc.Models.MemCmp{Bytes = Entity.ACCOUNT_DISCRIMINATOR_B58, Offset = 0}};
  163. var res = await RpcClient.GetProgramAccountsAsync(programAddress, commitment, memCmpList: list);
  164. if (!res.WasSuccessful || !(res.Result?.Count > 0))
  165. return new Solana.Unity.Programs.Models.ProgramAccountsResultWrapper<List<Entity>>(res);
  166. List<Entity> resultingAccounts = new List<Entity>(res.Result.Count);
  167. resultingAccounts.AddRange(res.Result.Select(result => Entity.Deserialize(Convert.FromBase64String(result.Account.Data[0]))));
  168. return new Solana.Unity.Programs.Models.ProgramAccountsResultWrapper<List<Entity>>(res, resultingAccounts);
  169. }
  170. public async Task<Solana.Unity.Programs.Models.ProgramAccountsResultWrapper<List<Registry>>> GetRegistrysAsync(string programAddress = WorldProgram.ID, Commitment commitment = Commitment.Confirmed)
  171. {
  172. var list = new List<Solana.Unity.Rpc.Models.MemCmp>{new Solana.Unity.Rpc.Models.MemCmp{Bytes = Registry.ACCOUNT_DISCRIMINATOR_B58, Offset = 0}};
  173. var res = await RpcClient.GetProgramAccountsAsync(programAddress, commitment, memCmpList: list);
  174. if (!res.WasSuccessful || !(res.Result?.Count > 0))
  175. return new Solana.Unity.Programs.Models.ProgramAccountsResultWrapper<List<Registry>>(res);
  176. List<Registry> resultingAccounts = new List<Registry>(res.Result.Count);
  177. resultingAccounts.AddRange(res.Result.Select(result => Registry.Deserialize(Convert.FromBase64String(result.Account.Data[0]))));
  178. return new Solana.Unity.Programs.Models.ProgramAccountsResultWrapper<List<Registry>>(res, resultingAccounts);
  179. }
  180. public async Task<Solana.Unity.Programs.Models.ProgramAccountsResultWrapper<List<SessionToken>>> GetSessionTokensAsync(string programAddress = WorldProgram.ID, Commitment commitment = Commitment.Confirmed)
  181. {
  182. var list = new List<Solana.Unity.Rpc.Models.MemCmp>{new Solana.Unity.Rpc.Models.MemCmp{Bytes = SessionToken.ACCOUNT_DISCRIMINATOR_B58, Offset = 0}};
  183. var res = await RpcClient.GetProgramAccountsAsync(programAddress, commitment, memCmpList: list);
  184. if (!res.WasSuccessful || !(res.Result?.Count > 0))
  185. return new Solana.Unity.Programs.Models.ProgramAccountsResultWrapper<List<SessionToken>>(res);
  186. List<SessionToken> resultingAccounts = new List<SessionToken>(res.Result.Count);
  187. resultingAccounts.AddRange(res.Result.Select(result => SessionToken.Deserialize(Convert.FromBase64String(result.Account.Data[0]))));
  188. return new Solana.Unity.Programs.Models.ProgramAccountsResultWrapper<List<SessionToken>>(res, resultingAccounts);
  189. }
  190. public async Task<Solana.Unity.Programs.Models.ProgramAccountsResultWrapper<List<World.Accounts.World>>> GetWorldsAsync(string programAddress = WorldProgram.ID, Commitment commitment = Commitment.Confirmed)
  191. {
  192. var list = new List<Solana.Unity.Rpc.Models.MemCmp>{new Solana.Unity.Rpc.Models.MemCmp{Bytes = World.Accounts.World.ACCOUNT_DISCRIMINATOR_B58, Offset = 0}};
  193. var res = await RpcClient.GetProgramAccountsAsync(programAddress, commitment, memCmpList: list);
  194. if (!res.WasSuccessful || !(res.Result?.Count > 0))
  195. return new Solana.Unity.Programs.Models.ProgramAccountsResultWrapper<List<World.Accounts.World>>(res);
  196. List<World.Accounts.World> resultingAccounts = new List<World.Accounts.World>(res.Result.Count);
  197. resultingAccounts.AddRange(res.Result.Select(result => World.Accounts.World.Deserialize(Convert.FromBase64String(result.Account.Data[0]))));
  198. return new Solana.Unity.Programs.Models.ProgramAccountsResultWrapper<List<World.Accounts.World>>(res, resultingAccounts);
  199. }
  200. public async Task<Solana.Unity.Programs.Models.AccountResultWrapper<Entity>> GetEntityAsync(string accountAddress, Commitment commitment = Commitment.Finalized)
  201. {
  202. var res = await RpcClient.GetAccountInfoAsync(accountAddress, commitment);
  203. if (!res.WasSuccessful)
  204. return new Solana.Unity.Programs.Models.AccountResultWrapper<Entity>(res);
  205. var resultingAccount = Entity.Deserialize(Convert.FromBase64String(res.Result.Value.Data[0]));
  206. return new Solana.Unity.Programs.Models.AccountResultWrapper<Entity>(res, resultingAccount);
  207. }
  208. public async Task<Solana.Unity.Programs.Models.AccountResultWrapper<Registry>> GetRegistryAsync(string accountAddress, Commitment commitment = Commitment.Finalized)
  209. {
  210. var res = await RpcClient.GetAccountInfoAsync(accountAddress, commitment);
  211. if (!res.WasSuccessful)
  212. return new Solana.Unity.Programs.Models.AccountResultWrapper<Registry>(res);
  213. var resultingAccount = Registry.Deserialize(Convert.FromBase64String(res.Result.Value.Data[0]));
  214. return new Solana.Unity.Programs.Models.AccountResultWrapper<Registry>(res, resultingAccount);
  215. }
  216. public async Task<Solana.Unity.Programs.Models.AccountResultWrapper<SessionToken>> GetSessionTokenAsync(string accountAddress, Commitment commitment = Commitment.Finalized)
  217. {
  218. var res = await RpcClient.GetAccountInfoAsync(accountAddress, commitment);
  219. if (!res.WasSuccessful)
  220. return new Solana.Unity.Programs.Models.AccountResultWrapper<SessionToken>(res);
  221. var resultingAccount = SessionToken.Deserialize(Convert.FromBase64String(res.Result.Value.Data[0]));
  222. return new Solana.Unity.Programs.Models.AccountResultWrapper<SessionToken>(res, resultingAccount);
  223. }
  224. public async Task<Solana.Unity.Programs.Models.AccountResultWrapper<World.Accounts.World>> GetWorldAsync(string accountAddress, Commitment commitment = Commitment.Finalized)
  225. {
  226. var res = await RpcClient.GetAccountInfoAsync(accountAddress, commitment);
  227. if (!res.WasSuccessful)
  228. return new Solana.Unity.Programs.Models.AccountResultWrapper<World.Accounts.World>(res);
  229. var resultingAccount = World.Accounts.World.Deserialize(Convert.FromBase64String(res.Result.Value.Data[0]));
  230. return new Solana.Unity.Programs.Models.AccountResultWrapper<World.Accounts.World>(res, resultingAccount);
  231. }
  232. 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)
  233. {
  234. SubscriptionState res = await StreamingRpcClient.SubscribeAccountInfoAsync(accountAddress, (s, e) =>
  235. {
  236. Entity parsingResult = null;
  237. if (e.Value?.Data?.Count > 0)
  238. parsingResult = Entity.Deserialize(Convert.FromBase64String(e.Value.Data[0]));
  239. callback(s, e, parsingResult);
  240. }, commitment);
  241. return res;
  242. }
  243. 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)
  244. {
  245. SubscriptionState res = await StreamingRpcClient.SubscribeAccountInfoAsync(accountAddress, (s, e) =>
  246. {
  247. Registry parsingResult = null;
  248. if (e.Value?.Data?.Count > 0)
  249. parsingResult = Registry.Deserialize(Convert.FromBase64String(e.Value.Data[0]));
  250. callback(s, e, parsingResult);
  251. }, commitment);
  252. return res;
  253. }
  254. 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)
  255. {
  256. SubscriptionState res = await StreamingRpcClient.SubscribeAccountInfoAsync(accountAddress, (s, e) =>
  257. {
  258. SessionToken parsingResult = null;
  259. if (e.Value?.Data?.Count > 0)
  260. parsingResult = SessionToken.Deserialize(Convert.FromBase64String(e.Value.Data[0]));
  261. callback(s, e, parsingResult);
  262. }, commitment);
  263. return res;
  264. }
  265. 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)
  266. {
  267. SubscriptionState res = await StreamingRpcClient.SubscribeAccountInfoAsync(accountAddress, (s, e) =>
  268. {
  269. World.Accounts.World parsingResult = null;
  270. if (e.Value?.Data?.Count > 0)
  271. parsingResult = World.Accounts.World.Deserialize(Convert.FromBase64String(e.Value.Data[0]));
  272. callback(s, e, parsingResult);
  273. }, commitment);
  274. return res;
  275. }
  276. protected override Dictionary<uint, ProgramError<WorldErrorKind>> BuildErrorsDictionary()
  277. {
  278. 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")}, };
  279. }
  280. }
  281. namespace Program
  282. {
  283. public class AddAuthorityAccounts
  284. {
  285. public PublicKey Authority { get; set; }
  286. public PublicKey NewAuthority { get; set; }
  287. public PublicKey World { get; set; }
  288. public PublicKey SystemProgram { get; set; } = new PublicKey("11111111111111111111111111111111");
  289. }
  290. public class AddEntityAccounts
  291. {
  292. public PublicKey Payer { get; set; }
  293. public PublicKey Entity { get; set; }
  294. public PublicKey World { get; set; }
  295. public PublicKey SystemProgram { get; set; } = new PublicKey("11111111111111111111111111111111");
  296. }
  297. public class ApplyAccounts
  298. {
  299. public PublicKey Buffer { get; set; }
  300. public PublicKey BoltSystem { get; set; }
  301. public PublicKey Authority { get; set; }
  302. public PublicKey CpiAuth { get; set; }
  303. public PublicKey World { get; set; }
  304. public PublicKey SystemProgram { get; set; } = new PublicKey("11111111111111111111111111111111");
  305. }
  306. public class ApplyWithSessionAccounts
  307. {
  308. public PublicKey Buffer { get; set; }
  309. public PublicKey BoltSystem { get; set; }
  310. public PublicKey Authority { get; set; }
  311. public PublicKey CpiAuth { get; set; }
  312. public PublicKey World { get; set; }
  313. public PublicKey SessionToken { get; set; }
  314. public PublicKey SystemProgram { get; set; } = new PublicKey("11111111111111111111111111111111");
  315. }
  316. public class ApproveSystemAccounts
  317. {
  318. public PublicKey Authority { get; set; }
  319. public PublicKey World { get; set; }
  320. public PublicKey System { get; set; }
  321. public PublicKey SystemProgram { get; set; } = new PublicKey("11111111111111111111111111111111");
  322. }
  323. public class DestroyComponentAccounts
  324. {
  325. public PublicKey Authority { get; set; }
  326. public PublicKey Receiver { get; set; }
  327. public PublicKey ComponentProgram { get; set; }
  328. public PublicKey ComponentProgramData { get; set; }
  329. public PublicKey Entity { get; set; }
  330. public PublicKey Component { get; set; }
  331. public PublicKey CpiAuth { get; set; }
  332. public PublicKey SystemProgram { get; set; } = new PublicKey("11111111111111111111111111111111");
  333. }
  334. public class InitializeComponentAccounts
  335. {
  336. public PublicKey Payer { get; set; }
  337. public PublicKey Data { get; set; }
  338. public PublicKey Entity { get; set; }
  339. public PublicKey ComponentProgram { get; set; }
  340. public PublicKey Authority { get; set; }
  341. public PublicKey CpiAuth { get; set; }
  342. public PublicKey SystemProgram { get; set; } = new PublicKey("11111111111111111111111111111111");
  343. public PublicKey Buffer { get; set; }
  344. }
  345. public class InitializeNewWorldAccounts
  346. {
  347. public PublicKey Payer { get; set; }
  348. public PublicKey World { get; set; }
  349. public PublicKey Registry { get; set; }
  350. public PublicKey SystemProgram { get; set; } = new PublicKey("11111111111111111111111111111111");
  351. }
  352. public class InitializeRegistryAccounts
  353. {
  354. public PublicKey Registry { get; set; }
  355. public PublicKey Payer { get; set; }
  356. public PublicKey SystemProgram { get; set; } = new PublicKey("11111111111111111111111111111111");
  357. }
  358. public class RemoveAuthorityAccounts
  359. {
  360. public PublicKey Authority { get; set; }
  361. public PublicKey AuthorityToDelete { get; set; }
  362. public PublicKey World { get; set; }
  363. public PublicKey SystemProgram { get; set; } = new PublicKey("11111111111111111111111111111111");
  364. }
  365. public class RemoveSystemAccounts
  366. {
  367. public PublicKey Authority { get; set; }
  368. public PublicKey World { get; set; }
  369. public PublicKey System { get; set; }
  370. public PublicKey SystemProgram { get; set; } = new PublicKey("11111111111111111111111111111111");
  371. }
  372. public partial class WorldProgram
  373. {
  374. public const string ID = "WorLD15A7CrDwLcLy4fRqtaTb9fbd8o8iqiEMUDse2n";
  375. public static Solana.Unity.Rpc.Models.TransactionInstruction AddAuthority(AddAuthorityAccounts accounts, ulong world_id, PublicKey programId = null)
  376. {
  377. programId ??= new(ID);
  378. List<Solana.Unity.Rpc.Models.AccountMeta> keys = new()
  379. {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)};
  380. byte[] _data = new byte[1200];
  381. int offset = 0;
  382. _data.WriteU64(13217455069452700133UL, offset);
  383. offset += 8;
  384. _data.WriteU64(world_id, offset);
  385. offset += 8;
  386. byte[] resultData = new byte[offset];
  387. Array.Copy(_data, resultData, offset);
  388. return new Solana.Unity.Rpc.Models.TransactionInstruction{Keys = keys, ProgramId = programId.KeyBytes, Data = resultData};
  389. }
  390. public static Solana.Unity.Rpc.Models.TransactionInstruction AddEntity(AddEntityAccounts accounts, byte[] extra_seed, PublicKey programId = null)
  391. {
  392. programId ??= new(ID);
  393. List<Solana.Unity.Rpc.Models.AccountMeta> keys = new()
  394. {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)};
  395. byte[] _data = new byte[1200];
  396. int offset = 0;
  397. _data.WriteU64(4121062988444201379UL, offset);
  398. offset += 8;
  399. if (extra_seed != null)
  400. {
  401. _data.WriteU8(1, offset);
  402. offset += 1;
  403. _data.WriteS32(extra_seed.Length, offset);
  404. offset += 4;
  405. _data.WriteSpan(extra_seed, offset);
  406. offset += extra_seed.Length;
  407. }
  408. else
  409. {
  410. _data.WriteU8(0, offset);
  411. offset += 1;
  412. }
  413. byte[] resultData = new byte[offset];
  414. Array.Copy(_data, resultData, offset);
  415. return new Solana.Unity.Rpc.Models.TransactionInstruction{Keys = keys, ProgramId = programId.KeyBytes, Data = resultData};
  416. }
  417. public static Solana.Unity.Rpc.Models.TransactionInstruction Apply(ApplyAccounts accounts, byte[] args, PublicKey programId = null)
  418. {
  419. programId ??= new(ID);
  420. List<Solana.Unity.Rpc.Models.AccountMeta> keys = new()
  421. {Solana.Unity.Rpc.Models.AccountMeta.Writable(accounts.Buffer, false), Solana.Unity.Rpc.Models.AccountMeta.ReadOnly(accounts.BoltSystem, false), Solana.Unity.Rpc.Models.AccountMeta.Writable(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)};
  422. byte[] _data = new byte[1200];
  423. int offset = 0;
  424. _data.WriteU64(16258613031726085112UL, offset);
  425. offset += 8;
  426. _data.WriteS32(args.Length, offset);
  427. offset += 4;
  428. _data.WriteSpan(args, offset);
  429. offset += args.Length;
  430. byte[] resultData = new byte[offset];
  431. Array.Copy(_data, resultData, offset);
  432. return new Solana.Unity.Rpc.Models.TransactionInstruction{Keys = keys, ProgramId = programId.KeyBytes, Data = resultData};
  433. }
  434. public static Solana.Unity.Rpc.Models.TransactionInstruction ApplyWithSession(ApplyWithSessionAccounts accounts, byte[] args, PublicKey programId = null)
  435. {
  436. programId ??= new(ID);
  437. List<Solana.Unity.Rpc.Models.AccountMeta> keys = new()
  438. {Solana.Unity.Rpc.Models.AccountMeta.Writable(accounts.Buffer, false), Solana.Unity.Rpc.Models.AccountMeta.ReadOnly(accounts.BoltSystem, false), Solana.Unity.Rpc.Models.AccountMeta.Writable(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)};
  439. byte[] _data = new byte[1200];
  440. int offset = 0;
  441. _data.WriteU64(7459768094276011477UL, offset);
  442. offset += 8;
  443. _data.WriteS32(args.Length, offset);
  444. offset += 4;
  445. _data.WriteSpan(args, offset);
  446. offset += args.Length;
  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 ApproveSystem(ApproveSystemAccounts accounts, 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.Writable(accounts.World, false), Solana.Unity.Rpc.Models.AccountMeta.ReadOnly(accounts.System, false), Solana.Unity.Rpc.Models.AccountMeta.ReadOnly(accounts.SystemProgram, false)};
  456. byte[] _data = new byte[1200];
  457. int offset = 0;
  458. _data.WriteU64(8777308090533520754UL, offset);
  459. offset += 8;
  460. byte[] resultData = new byte[offset];
  461. Array.Copy(_data, resultData, offset);
  462. return new Solana.Unity.Rpc.Models.TransactionInstruction{Keys = keys, ProgramId = programId.KeyBytes, Data = resultData};
  463. }
  464. public static Solana.Unity.Rpc.Models.TransactionInstruction DestroyComponent(DestroyComponentAccounts accounts, PublicKey programId = null)
  465. {
  466. programId ??= new(ID);
  467. List<Solana.Unity.Rpc.Models.AccountMeta> keys = new()
  468. {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)};
  469. byte[] _data = new byte[1200];
  470. int offset = 0;
  471. _data.WriteU64(5321952129328727336UL, offset);
  472. offset += 8;
  473. byte[] resultData = new byte[offset];
  474. Array.Copy(_data, resultData, offset);
  475. return new Solana.Unity.Rpc.Models.TransactionInstruction{Keys = keys, ProgramId = programId.KeyBytes, Data = resultData};
  476. }
  477. public static Solana.Unity.Rpc.Models.TransactionInstruction InitializeComponent(InitializeComponentAccounts accounts, PublicKey programId = null)
  478. {
  479. programId ??= new(ID);
  480. List<Solana.Unity.Rpc.Models.AccountMeta> keys = new()
  481. {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), Solana.Unity.Rpc.Models.AccountMeta.Writable(accounts.Buffer, false)};
  482. byte[] _data = new byte[1200];
  483. int offset = 0;
  484. _data.WriteU64(2179155133888827172UL, offset);
  485. offset += 8;
  486. byte[] resultData = new byte[offset];
  487. Array.Copy(_data, resultData, offset);
  488. return new Solana.Unity.Rpc.Models.TransactionInstruction{Keys = keys, ProgramId = programId.KeyBytes, Data = resultData};
  489. }
  490. public static Solana.Unity.Rpc.Models.TransactionInstruction InitializeNewWorld(InitializeNewWorldAccounts accounts, PublicKey programId = null)
  491. {
  492. programId ??= new(ID);
  493. List<Solana.Unity.Rpc.Models.AccountMeta> keys = new()
  494. {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)};
  495. byte[] _data = new byte[1200];
  496. int offset = 0;
  497. _data.WriteU64(7118163274173538327UL, offset);
  498. offset += 8;
  499. byte[] resultData = new byte[offset];
  500. Array.Copy(_data, resultData, offset);
  501. return new Solana.Unity.Rpc.Models.TransactionInstruction{Keys = keys, ProgramId = programId.KeyBytes, Data = resultData};
  502. }
  503. public static Solana.Unity.Rpc.Models.TransactionInstruction InitializeRegistry(InitializeRegistryAccounts accounts, PublicKey programId = null)
  504. {
  505. programId ??= new(ID);
  506. List<Solana.Unity.Rpc.Models.AccountMeta> keys = new()
  507. {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)};
  508. byte[] _data = new byte[1200];
  509. int offset = 0;
  510. _data.WriteU64(4321548737212364221UL, offset);
  511. offset += 8;
  512. byte[] resultData = new byte[offset];
  513. Array.Copy(_data, resultData, offset);
  514. return new Solana.Unity.Rpc.Models.TransactionInstruction{Keys = keys, ProgramId = programId.KeyBytes, Data = resultData};
  515. }
  516. public static Solana.Unity.Rpc.Models.TransactionInstruction RemoveAuthority(RemoveAuthorityAccounts accounts, ulong world_id, PublicKey programId = null)
  517. {
  518. programId ??= new(ID);
  519. List<Solana.Unity.Rpc.Models.AccountMeta> keys = new()
  520. {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)};
  521. byte[] _data = new byte[1200];
  522. int offset = 0;
  523. _data.WriteU64(15585545156648003826UL, offset);
  524. offset += 8;
  525. _data.WriteU64(world_id, offset);
  526. offset += 8;
  527. byte[] resultData = new byte[offset];
  528. Array.Copy(_data, resultData, offset);
  529. return new Solana.Unity.Rpc.Models.TransactionInstruction{Keys = keys, ProgramId = programId.KeyBytes, Data = resultData};
  530. }
  531. public static Solana.Unity.Rpc.Models.TransactionInstruction RemoveSystem(RemoveSystemAccounts accounts, PublicKey programId = null)
  532. {
  533. programId ??= new(ID);
  534. List<Solana.Unity.Rpc.Models.AccountMeta> keys = new()
  535. {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)};
  536. byte[] _data = new byte[1200];
  537. int offset = 0;
  538. _data.WriteU64(8688994685429436634UL, offset);
  539. offset += 8;
  540. byte[] resultData = new byte[offset];
  541. Array.Copy(_data, resultData, offset);
  542. return new Solana.Unity.Rpc.Models.TransactionInstruction{Keys = keys, ProgramId = programId.KeyBytes, Data = resultData};
  543. }
  544. }
  545. }
  546. }