From 753c5e6df36028a7a764b2228cc25ca9ad487b3b Mon Sep 17 00:00:00 2001 From: Gabriele Picco Date: Sun, 22 Oct 2023 15:38:23 +0200 Subject: [PATCH] :sparkles: Add default Rpc for localnet --- src/Solana.Unity.Programs/SysVars.cs | 2 +- src/Solana.Unity.Rpc/ClientFactory.cs | 10 ++++++++++ src/Solana.Unity.Rpc/Cluster.cs | 7 ++++++- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/Solana.Unity.Programs/SysVars.cs b/src/Solana.Unity.Programs/SysVars.cs index becea295..a014afa6 100644 --- a/src/Solana.Unity.Programs/SysVars.cs +++ b/src/Solana.Unity.Programs/SysVars.cs @@ -20,7 +20,7 @@ public static class SysVars /// /// The public key of the Recent Slot Hashes System Variable. /// - public static readonly PublicKet RecentSlotHashesKey = new("SysvarS1otHashes111111111111111111111111111"); + public static readonly PublicKey RecentSlotHashesKey = new("SysvarS1otHashes111111111111111111111111111"); /// /// The public key of the Rent System Variable. diff --git a/src/Solana.Unity.Rpc/ClientFactory.cs b/src/Solana.Unity.Rpc/ClientFactory.cs index 8cfc6e4b..d0df9bb9 100644 --- a/src/Solana.Unity.Rpc/ClientFactory.cs +++ b/src/Solana.Unity.Rpc/ClientFactory.cs @@ -9,6 +9,10 @@ namespace Solana.Unity.Rpc /// public static class ClientFactory { + /// + /// The local net cluster. + /// + private const string RpcLocalNet = "http://127.0.0.1:8899"; /// /// The dev net cluster. /// @@ -24,6 +28,10 @@ public static class ClientFactory /// private const string RpcMainNet = "https://api.mainnet-beta.solana.com"; + /// + /// The localnet net cluster. + /// + private const string StreamingRpcLocalNet = "ws://127.0.0.1:8900"; /// /// The dev net cluster. @@ -91,6 +99,7 @@ public static IRpcClient GetClient(Cluster cluster, object logger = null, { Cluster.DevNet => RpcDevNet, Cluster.TestNet => RpcTestNet, + Cluster.LocalNet => RpcLocalNet, _ => RpcMainNet, }; @@ -147,6 +156,7 @@ public static IStreamingRpcClient GetStreamingClient( { Cluster.DevNet => StreamingRpcDevNet, Cluster.TestNet => StreamingRpcTestNet, + Cluster.LocalNet => StreamingRpcLocalNet, _ => StreamingRpcMainNet, }; return GetStreamingClient(url, logger); diff --git a/src/Solana.Unity.Rpc/Cluster.cs b/src/Solana.Unity.Rpc/Cluster.cs index dd2465f6..87dd1ddb 100644 --- a/src/Solana.Unity.Rpc/Cluster.cs +++ b/src/Solana.Unity.Rpc/Cluster.cs @@ -42,6 +42,11 @@ public enum Cluster /// /// Tokens that are issued on Mainnet Beta are real SOL. /// - MainNet + MainNet, + + /// + /// A local cluster for development and testing. + /// + LocalNet } } \ No newline at end of file