Generated.cs 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649
  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. }
  344. public class InitializeNewWorldAccounts
  345. {
  346. public PublicKey Payer { get; set; }
  347. public PublicKey World { get; set; }
  348. public PublicKey Registry { get; set; }
  349. public PublicKey SystemProgram { get; set; } = new PublicKey("11111111111111111111111111111111");
  350. }
  351. public class InitializeRegistryAccounts
  352. {
  353. public PublicKey Registry { get; set; }
  354. public PublicKey Payer { get; set; }
  355. public PublicKey SystemProgram { get; set; } = new PublicKey("11111111111111111111111111111111");
  356. }
  357. public class RemoveAuthorityAccounts
  358. {
  359. public PublicKey Authority { get; set; }
  360. public PublicKey AuthorityToDelete { get; set; }
  361. public PublicKey World { get; set; }
  362. public PublicKey SystemProgram { get; set; } = new PublicKey("11111111111111111111111111111111");
  363. }
  364. public class RemoveSystemAccounts
  365. {
  366. public PublicKey Authority { get; set; }
  367. public PublicKey World { get; set; }
  368. public PublicKey System { get; set; }
  369. public PublicKey SystemProgram { get; set; } = new PublicKey("11111111111111111111111111111111");
  370. }
  371. public partial class WorldProgram
  372. {
  373. public const string ID = "WorLD15A7CrDwLcLy4fRqtaTb9fbd8o8iqiEMUDse2n";
  374. public static Solana.Unity.Rpc.Models.TransactionInstruction AddAuthority(AddAuthorityAccounts accounts, ulong world_id, PublicKey programId = null)
  375. {
  376. programId ??= new(ID);
  377. List<Solana.Unity.Rpc.Models.AccountMeta> keys = new()
  378. {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)};
  379. byte[] _data = new byte[1200];
  380. int offset = 0;
  381. _data.WriteU64(13217455069452700133UL, offset);
  382. offset += 8;
  383. _data.WriteU64(world_id, offset);
  384. offset += 8;
  385. byte[] resultData = new byte[offset];
  386. Array.Copy(_data, resultData, offset);
  387. return new Solana.Unity.Rpc.Models.TransactionInstruction{Keys = keys, ProgramId = programId.KeyBytes, Data = resultData};
  388. }
  389. public static Solana.Unity.Rpc.Models.TransactionInstruction AddEntity(AddEntityAccounts accounts, byte[] extra_seed, PublicKey programId = null)
  390. {
  391. programId ??= new(ID);
  392. List<Solana.Unity.Rpc.Models.AccountMeta> keys = new()
  393. {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)};
  394. byte[] _data = new byte[1200];
  395. int offset = 0;
  396. _data.WriteU64(4121062988444201379UL, offset);
  397. offset += 8;
  398. if (extra_seed != null)
  399. {
  400. _data.WriteU8(1, offset);
  401. offset += 1;
  402. _data.WriteS32(extra_seed.Length, offset);
  403. offset += 4;
  404. _data.WriteSpan(extra_seed, offset);
  405. offset += extra_seed.Length;
  406. }
  407. else
  408. {
  409. _data.WriteU8(0, offset);
  410. offset += 1;
  411. }
  412. byte[] resultData = new byte[offset];
  413. Array.Copy(_data, resultData, offset);
  414. return new Solana.Unity.Rpc.Models.TransactionInstruction{Keys = keys, ProgramId = programId.KeyBytes, Data = resultData};
  415. }
  416. public static Solana.Unity.Rpc.Models.TransactionInstruction Apply(ApplyAccounts accounts, byte[] args, PublicKey programId = null)
  417. {
  418. programId ??= new(ID);
  419. List<Solana.Unity.Rpc.Models.AccountMeta> keys = new()
  420. {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)};
  421. byte[] _data = new byte[1200];
  422. int offset = 0;
  423. _data.WriteU64(16258613031726085112UL, offset);
  424. offset += 8;
  425. _data.WriteS32(args.Length, offset);
  426. offset += 4;
  427. _data.WriteSpan(args, offset);
  428. offset += args.Length;
  429. byte[] resultData = new byte[offset];
  430. Array.Copy(_data, resultData, offset);
  431. return new Solana.Unity.Rpc.Models.TransactionInstruction{Keys = keys, ProgramId = programId.KeyBytes, Data = resultData};
  432. }
  433. public static Solana.Unity.Rpc.Models.TransactionInstruction ApplyWithSession(ApplyWithSessionAccounts accounts, byte[] args, PublicKey programId = null)
  434. {
  435. programId ??= new(ID);
  436. List<Solana.Unity.Rpc.Models.AccountMeta> keys = new()
  437. {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)};
  438. byte[] _data = new byte[1200];
  439. int offset = 0;
  440. _data.WriteU64(7459768094276011477UL, offset);
  441. offset += 8;
  442. _data.WriteS32(args.Length, offset);
  443. offset += 4;
  444. _data.WriteSpan(args, offset);
  445. offset += args.Length;
  446. byte[] resultData = new byte[offset];
  447. Array.Copy(_data, resultData, offset);
  448. return new Solana.Unity.Rpc.Models.TransactionInstruction{Keys = keys, ProgramId = programId.KeyBytes, Data = resultData};
  449. }
  450. public static Solana.Unity.Rpc.Models.TransactionInstruction ApproveSystem(ApproveSystemAccounts accounts, PublicKey programId = null)
  451. {
  452. programId ??= new(ID);
  453. List<Solana.Unity.Rpc.Models.AccountMeta> keys = new()
  454. {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)};
  455. byte[] _data = new byte[1200];
  456. int offset = 0;
  457. _data.WriteU64(8777308090533520754UL, offset);
  458. offset += 8;
  459. byte[] resultData = new byte[offset];
  460. Array.Copy(_data, resultData, offset);
  461. return new Solana.Unity.Rpc.Models.TransactionInstruction{Keys = keys, ProgramId = programId.KeyBytes, Data = resultData};
  462. }
  463. public static Solana.Unity.Rpc.Models.TransactionInstruction DestroyComponent(DestroyComponentAccounts accounts, PublicKey programId = null)
  464. {
  465. programId ??= new(ID);
  466. List<Solana.Unity.Rpc.Models.AccountMeta> keys = new()
  467. {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)};
  468. byte[] _data = new byte[1200];
  469. int offset = 0;
  470. _data.WriteU64(5321952129328727336UL, offset);
  471. offset += 8;
  472. byte[] resultData = new byte[offset];
  473. Array.Copy(_data, resultData, offset);
  474. return new Solana.Unity.Rpc.Models.TransactionInstruction{Keys = keys, ProgramId = programId.KeyBytes, Data = resultData};
  475. }
  476. public static Solana.Unity.Rpc.Models.TransactionInstruction InitializeComponent(InitializeComponentAccounts accounts, PublicKey programId = null)
  477. {
  478. programId ??= new(ID);
  479. List<Solana.Unity.Rpc.Models.AccountMeta> keys = new()
  480. {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)};
  481. byte[] _data = new byte[1200];
  482. int offset = 0;
  483. _data.WriteU64(2179155133888827172UL, offset);
  484. offset += 8;
  485. byte[] resultData = new byte[offset];
  486. Array.Copy(_data, resultData, offset);
  487. return new Solana.Unity.Rpc.Models.TransactionInstruction{Keys = keys, ProgramId = programId.KeyBytes, Data = resultData};
  488. }
  489. public static Solana.Unity.Rpc.Models.TransactionInstruction InitializeNewWorld(InitializeNewWorldAccounts accounts, PublicKey programId = null)
  490. {
  491. programId ??= new(ID);
  492. List<Solana.Unity.Rpc.Models.AccountMeta> keys = new()
  493. {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)};
  494. byte[] _data = new byte[1200];
  495. int offset = 0;
  496. _data.WriteU64(7118163274173538327UL, offset);
  497. offset += 8;
  498. byte[] resultData = new byte[offset];
  499. Array.Copy(_data, resultData, offset);
  500. return new Solana.Unity.Rpc.Models.TransactionInstruction{Keys = keys, ProgramId = programId.KeyBytes, Data = resultData};
  501. }
  502. public static Solana.Unity.Rpc.Models.TransactionInstruction InitializeRegistry(InitializeRegistryAccounts accounts, PublicKey programId = null)
  503. {
  504. programId ??= new(ID);
  505. List<Solana.Unity.Rpc.Models.AccountMeta> keys = new()
  506. {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)};
  507. byte[] _data = new byte[1200];
  508. int offset = 0;
  509. _data.WriteU64(4321548737212364221UL, offset);
  510. offset += 8;
  511. byte[] resultData = new byte[offset];
  512. Array.Copy(_data, resultData, offset);
  513. return new Solana.Unity.Rpc.Models.TransactionInstruction{Keys = keys, ProgramId = programId.KeyBytes, Data = resultData};
  514. }
  515. public static Solana.Unity.Rpc.Models.TransactionInstruction RemoveAuthority(RemoveAuthorityAccounts accounts, ulong world_id, PublicKey programId = null)
  516. {
  517. programId ??= new(ID);
  518. List<Solana.Unity.Rpc.Models.AccountMeta> keys = new()
  519. {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)};
  520. byte[] _data = new byte[1200];
  521. int offset = 0;
  522. _data.WriteU64(15585545156648003826UL, offset);
  523. offset += 8;
  524. _data.WriteU64(world_id, offset);
  525. offset += 8;
  526. byte[] resultData = new byte[offset];
  527. Array.Copy(_data, resultData, offset);
  528. return new Solana.Unity.Rpc.Models.TransactionInstruction{Keys = keys, ProgramId = programId.KeyBytes, Data = resultData};
  529. }
  530. public static Solana.Unity.Rpc.Models.TransactionInstruction RemoveSystem(RemoveSystemAccounts accounts, PublicKey programId = null)
  531. {
  532. programId ??= new(ID);
  533. List<Solana.Unity.Rpc.Models.AccountMeta> keys = new()
  534. {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)};
  535. byte[] _data = new byte[1200];
  536. int offset = 0;
  537. _data.WriteU64(8688994685429436634UL, offset);
  538. offset += 8;
  539. byte[] resultData = new byte[offset];
  540. Array.Copy(_data, resultData, offset);
  541. return new Solana.Unity.Rpc.Models.TransactionInstruction{Keys = keys, ProgramId = programId.KeyBytes, Data = resultData};
  542. }
  543. }
  544. }
  545. }