-
-
Save GabrielePicco/c438544a3f3cbb4618deac5da3f66ec3 to your computer and use it in GitHub Desktop.
MakeMove
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static Solana.Unity.Rpc.Models.TransactionInstruction MovePiece(MovePieceAccounts accounts, Square from, Square to, PublicKey programId) | |
{ | |
List<Solana.Unity.Rpc.Models.AccountMeta> keys = new() | |
{Solana.Unity.Rpc.Models.AccountMeta.Writable(accounts.Payer, true), Solana.Unity.Rpc.Models.AccountMeta.Writable(accounts.User, false), Solana.Unity.Rpc.Models.AccountMeta.Writable(accounts.AdversaryUser, false), Solana.Unity.Rpc.Models.AccountMeta.Writable(accounts.Game, false), accounts.SessionToken != null ? Solana.Unity.Rpc.Models.AccountMeta.ReadOnly(accounts.SessionToken, false) : Solana.Unity.Rpc.Models.AccountMeta.ReadOnly(programId, false)}; | |
byte[] _data = new byte[1200]; | |
int offset = 0; | |
_data.WriteU64(5542210051077342600UL, offset); | |
offset += 8; | |
offset += from.Serialize(_data, offset); | |
offset += to.Serialize(_data, offset); | |
byte[] resultData = new byte[offset]; | |
Array.Copy(_data, resultData, offset); | |
return new Solana.Unity.Rpc.Models.TransactionInstruction{Keys = keys, ProgramId = programId.KeyBytes, Data = resultData}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment