Skip to content

Commit 753c5e6

Browse files
committed
✨ Add default Rpc for localnet
1 parent 56399a1 commit 753c5e6

File tree

3 files changed

+17
-2
lines changed

3 files changed

+17
-2
lines changed

src/Solana.Unity.Programs/SysVars.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public static class SysVars
2020
/// <summary>
2121
/// The public key of the Recent Slot Hashes System Variable.
2222
/// </summary>
23-
public static readonly PublicKet RecentSlotHashesKey = new("SysvarS1otHashes111111111111111111111111111");
23+
public static readonly PublicKey RecentSlotHashesKey = new("SysvarS1otHashes111111111111111111111111111");
2424

2525
/// <summary>
2626
/// The public key of the Rent System Variable.

src/Solana.Unity.Rpc/ClientFactory.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ namespace Solana.Unity.Rpc
99
/// </summary>
1010
public static class ClientFactory
1111
{
12+
/// <summary>
13+
/// The local net cluster.
14+
/// </summary>
15+
private const string RpcLocalNet = "http://127.0.0.1:8899";
1216
/// <summary>
1317
/// The dev net cluster.
1418
/// </summary>
@@ -24,6 +28,10 @@ public static class ClientFactory
2428
/// </summary>
2529
private const string RpcMainNet = "https://api.mainnet-beta.solana.com";
2630

31+
/// <summary>
32+
/// The localnet net cluster.
33+
/// </summary>
34+
private const string StreamingRpcLocalNet = "ws://127.0.0.1:8900";
2735

2836
/// <summary>
2937
/// The dev net cluster.
@@ -91,6 +99,7 @@ public static IRpcClient GetClient(Cluster cluster, object logger = null,
9199
{
92100
Cluster.DevNet => RpcDevNet,
93101
Cluster.TestNet => RpcTestNet,
102+
Cluster.LocalNet => RpcLocalNet,
94103
_ => RpcMainNet,
95104
};
96105

@@ -147,6 +156,7 @@ public static IStreamingRpcClient GetStreamingClient(
147156
{
148157
Cluster.DevNet => StreamingRpcDevNet,
149158
Cluster.TestNet => StreamingRpcTestNet,
159+
Cluster.LocalNet => StreamingRpcLocalNet,
150160
_ => StreamingRpcMainNet,
151161
};
152162
return GetStreamingClient(url, logger);

src/Solana.Unity.Rpc/Cluster.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,11 @@ public enum Cluster
4242
/// <remarks>
4343
/// Tokens that are issued on Mainnet Beta are real SOL.
4444
/// </remarks>
45-
MainNet
45+
MainNet,
46+
47+
/// <summary>
48+
/// A local cluster for development and testing.
49+
/// </summary>
50+
LocalNet
4651
}
4752
}

0 commit comments

Comments
 (0)