Skip to content

Instantly share code, notes, and snippets.

View GabrielePicco's full-sized avatar
🚀

Gabriele Picco GabrielePicco

🚀
View GitHub Profile
@GabrielePicco
GabrielePicco / World.cs
Last active May 1, 2024 09:56
World.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Numerics;
using System.Threading.Tasks;
using Solana.Unity;
using Solana.Unity.Programs.Abstract;
using Solana.Unity.Programs.Utilities;
using Solana.Unity.Programs;
@GabrielePicco
GabrielePicco / .cs
Created June 27, 2023 15:00
MakeMove
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);
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Solnet.Programs.Abstract;
using Solnet.Programs.Utilities;
using Solnet.Rpc;
using Solnet.Rpc.Core.Http;
using Solnet.Rpc.Core.Sockets;
using Solnet.Rpc.Types;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;
using System.Threading.Tasks;
using Solnet;
using Solnet.Programs.Abstract;
using Solnet.Programs.Utilities;
using Solnet.Rpc;
using Solnet.Rpc.Builders;