diff --git a/NextGenSoftware.Holochain.HoloNET.Client/Enums/HolochainVersionEnum.cs b/NextGenSoftware.Holochain.HoloNET.Client/Enums/HolochainVersionEnum.cs
new file mode 100644
index 000000000..12f92419d
--- /dev/null
+++ b/NextGenSoftware.Holochain.HoloNET.Client/Enums/HolochainVersionEnum.cs
@@ -0,0 +1,23 @@
+namespace NextGenSoftware.Holochain.HoloNET.Client
+{
+ ///
+ /// Defines the supported versions of Holochain for protocol compatibility.
+ ///
+ public enum HolochainVersion
+ {
+ ///
+ /// Legacy Holochain version (0.0.x series) - Redux protocol
+ ///
+ Redux,
+
+ ///
+ /// RSM version (0.0.x series) - RSM protocol
+ ///
+ RSM,
+
+ ///
+ /// Latest stable Holochain version (0.5.2) - JSON-RPC 2.0 protocol
+ ///
+ Holochain_0_5_2
+ }
+}
diff --git a/NextGenSoftware.Holochain.HoloNET.Client/HoloNET Client/HoloNETClientAppBase/HoloNETClientAppBase - Requests.cs b/NextGenSoftware.Holochain.HoloNET.Client/HoloNET Client/HoloNETClientAppBase/HoloNETClientAppBase - Requests.cs
index a64bdb571..2bd989888 100644
--- a/NextGenSoftware.Holochain.HoloNET.Client/HoloNET Client/HoloNETClientAppBase/HoloNETClientAppBase - Requests.cs
+++ b/NextGenSoftware.Holochain.HoloNET.Client/HoloNET Client/HoloNETClientAppBase/HoloNETClientAppBase - Requests.cs
@@ -9,6 +9,7 @@
using NextGenSoftware.Logging;
using NextGenSoftware.Holochain.HoloNET.Client.Interfaces;
using Sodium;
+using System.Text.Json;
namespace NextGenSoftware.Holochain.HoloNET.Client
{
@@ -554,6 +555,7 @@ public async Task CallZomeFunctionAsync(string id
/// A basic CLR object containing the params the zome function is expecting (optional param).
/// This is an optional param, which defaults to true. Set this to true if you wish HoloNET to give the zome and zome function that made the call in the callback/event. If this is false then only the id will be given in the callback. This uses a small internal cache to match up the id to the given zome/function. Set this to false if you wish to save a tiny amount of memory by not utilizing this cache. If it is false then the `Zome` and `ZomeFunction` params will be missing in the ZomeCallBack, you will need to manually match the `id` to the call yourself. NOTE: If HoloNETDNA.EnforceRequestToResponseIdMatchingBehaviour is set to Warn or Error then this param will be ignored and the matching will always occur.
/// This is an optional param, which defaults to false. Set this to true if you wish HoloNET to cache the response retrieved from holochain. Subsequent calls will return this cached data rather than calling the Holochain conductor again. Use this for static data that is not going to change for performance gains.
+ /// This is an optional param, where the caller can pass in the type of the dynamic data object they wish the entry data returned to be mapped to. This newly created data object will then be returned in the ZomeFunctionCallBackEventArgs.Entry.EntryDataObject property.
/// This is an optional param, where the caller can choose whether to wait for the Holochain Conductor response before returning to the caller or to return immediately once the request has been sent to the Holochain Conductor and then raise the OnDataReceived and then the OnZomeFunctionCallBack or OnSignalsCallBack events depending on the type of request sent to the Holochain Conductor.
///
public async Task CallZomeFunctionAsync(string id, string zome, string function, ZomeFunctionCallBack callback, object paramsObject, bool matchIdToZomeFuncInCallback = true, bool cachReturnData = false, ConductorResponseCallBackMode zomeResultCallBackMode = ConductorResponseCallBackMode.WaitForHolochainConductorResponse)
@@ -638,63 +640,27 @@ public async Task CallZomeFunctionAsync(string id
if (_signingCredentialsForCell.ContainsKey(cellId) && _signingCredentialsForCell[cellId] != null)
{
- ZomeCallUnsigned payload = new ZomeCallUnsigned()
- {
- cap_secret = _signingCredentialsForCell[cellId].CapSecret,
- cell_id_agent_pub_key = ConvertHoloHashToBytes(HoloNETDNA.AgentPubKey),
- cell_id_dna_hash = ConvertHoloHashToBytes(HoloNETDNA.DnaHash),
- fn_name = function,
- zome_name = zome,
- payload = MessagePackSerializer.Serialize(paramsObject),
- provenance = _signingCredentialsForCell[cellId].SigningKey,
- nonce = SodiumCore.GetRandomBytes(32),
- //expires_at = DateTime.Now.AddMinutes(5).Ticks / 10
- expires_at = (DateTimeOffset.Now.ToUnixTimeMilliseconds() + 5 * 60 * 1000) * 1000
- };
-
- byte[] hash = new byte[32];
- try
+ // Check if we should use JSON-RPC 2.0 protocol (Holochain 0.5.2)
+ if (HoloNETDNA?.HolochainVersion == HolochainVersion.Holochain_0_5_2)
{
- // Call into the `holochain_zome_types` crate to get a blake2b hash of the zomeCall
- HolochainSerialisationWrapper.call_get_data_to_sign(hash, payload);
+ await SendZomeCallHolochain052(id, zome, function, paramsObject, zomeResultCallBackMode);
}
- catch (Exception e)
+ else
{
- Console.WriteLine("Failed to get data to sign: " + e.ToString());
+ // Use legacy MessagePack protocol (Redux/RSM)
+ await SendZomeCallLegacy(id, zome, function, paramsObject, zomeResultCallBackMode, cellId);
}
-
- //byte[] hash = Blake2b.ComputeHash(MessagePackSerializer.Serialize(payload));
- var sig = Sodium.PublicKeyAuth.SignDetached(hash, _signingCredentialsForCell[cellId].KeyPair.PrivateKey);
-
- ZomeCallSigned signedPayload = new ZomeCallSigned()
- {
- cap_secret = payload.cap_secret,
- //cell_id = payload.cell_id,
- cell_id = [payload.cell_id_dna_hash, payload.cell_id_agent_pub_key],
- fn_name = payload.fn_name,
- zome_name = payload.zome_name,
- payload = payload.payload,
- provenance = payload.provenance,
- nonce = payload.nonce,
- expires_at = payload.expires_at,
- signature = sig[0..64]
- };
-
- HoloNETData holoNETData = new HoloNETData()
- {
- type = "call_zome",
- data = signedPayload
- };
-
- await SendHoloNETRequestAsync(holoNETData, HoloNETRequestType.ZomeCall, id);
-
+
+ // Return the result from the protocol-specific method
if (zomeResultCallBackMode == ConductorResponseCallBackMode.WaitForHolochainConductorResponse)
{
Task returnValue = _taskCompletionZomeCallBack[id].Task;
return await returnValue;
}
else
+ {
return new ZomeFunctionCallBackEventArgs() { EndPoint = EndPoint, Id = id, Zome = zome, ZomeFunction = function, Message = "ZomeResultCallBackMode is set to UseCallBackEvents so please wait for OnZomeFunctionCallBack event for zome result." };
+ }
}
else
{
@@ -710,6 +676,109 @@ public async Task CallZomeFunctionAsync(string id
}
}
+ ///
+ /// Sends a zome call using legacy MessagePack protocol (Redux/RSM)
+ ///
+ ///
+ /// Sends a zome call using JSON-RPC 2.0 protocol (Holochain 0.5.2)
+ ///
+ protected virtual async Task SendZomeCallHolochain052(string id, string zome, string function, object paramsObject, ConductorResponseCallBackMode zomeResultCallBackMode)
+ {
+ try
+ {
+ string cellId = $"{HoloNETDNA.AgentPubKey}_{HoloNETDNA.DnaHash}";
+ var request = new
+ {
+ jsonrpc = "2.0",
+ id = id,
+ method = "call_zome",
+ @params = new
+ {
+ zome_name = zome,
+ fn_name = function,
+ payload = paramsObject,
+ cell_id = cellId
+ }
+ };
+
+ string jsonRequest = System.Text.Json.JsonSerializer.Serialize(request);
+ await SendHoloNETRequestAsync(System.Text.Encoding.UTF8.GetBytes(jsonRequest), HoloNETRequestType.ZomeCall, id);
+ }
+ catch (Exception ex)
+ {
+ HandleError("Error occurred in HoloNETClient.SendZomeCallHolochain052 method.", ex);
+ }
+ }
+
+ protected virtual async Task SendZomeCallLegacy(string id, string zome, string function, object paramsObject, ConductorResponseCallBackMode zomeResultCallBackMode, string cellId)
+ {
+ try
+ {
+ ZomeCallUnsigned payload = new ZomeCallUnsigned()
+ {
+ cap_secret = _signingCredentialsForCell[cellId].CapSecret,
+ cell_id_agent_pub_key = ConvertHoloHashToBytes(HoloNETDNA.AgentPubKey),
+ cell_id_dna_hash = ConvertHoloHashToBytes(HoloNETDNA.DnaHash),
+ fn_name = function,
+ zome_name = zome,
+ payload = MessagePackSerializer.Serialize(paramsObject),
+ provenance = _signingCredentialsForCell[cellId].SigningKey,
+ nonce = SodiumCore.GetRandomBytes(32),
+ expires_at = (DateTimeOffset.Now.ToUnixTimeMilliseconds() + 5 * 60 * 1000) * 1000
+ };
+
+ byte[] hash = new byte[32];
+ try
+ {
+ // Call into the `holochain_zome_types` crate to get a blake2b hash of the zomeCall
+ HolochainSerialisationWrapper.call_get_data_to_sign(hash, payload);
+ }
+ catch (Exception e)
+ {
+ Console.WriteLine("Failed to get data to sign: " + e.ToString());
+ }
+
+ var sig = Sodium.PublicKeyAuth.SignDetached(hash, _signingCredentialsForCell[cellId].KeyPair.PrivateKey);
+
+ ZomeCallSigned signedPayload = new ZomeCallSigned()
+ {
+ cap_secret = payload.cap_secret,
+ cell_id = [payload.cell_id_dna_hash, payload.cell_id_agent_pub_key],
+ fn_name = payload.fn_name,
+ zome_name = payload.zome_name,
+ payload = payload.payload,
+ provenance = payload.provenance,
+ nonce = payload.nonce,
+ expires_at = payload.expires_at,
+ signature = sig[0..64]
+ };
+
+ HoloNETData holoNETData = new HoloNETData()
+ {
+ type = "call_zome",
+ data = signedPayload
+ };
+
+ await SendHoloNETRequestAsync(holoNETData, HoloNETRequestType.ZomeCall, id);
+
+ if (zomeResultCallBackMode == ConductorResponseCallBackMode.WaitForHolochainConductorResponse)
+ {
+ Task returnValue = _taskCompletionZomeCallBack[id].Task;
+ await returnValue;
+ }
+ else
+ {
+ // Return immediately for callback mode
+ return;
+ }
+ }
+ catch (Exception ex)
+ {
+ HandleError("Error occurred in HoloNETClient.SendZomeCallLegacy method.", ex);
+ throw; // Re-throw to be handled by caller
+ }
+ }
+
///
/// This is the main method you will be using to invoke zome functions on your given zome. It has a number of handy overloads making it easier and more powerful to call your zome functions and manage the returned data. This method raises the OnDataReceived event and then either the OnZomeFunctionCallBack or OnSignalCallBack event once it has received a response from the Holochain conductor.
///
@@ -844,7 +913,7 @@ public ZomeFunctionCallBackEventArgs CallZomeFunction(string id, string zome, st
public ZomeFunctionCallBackEventArgs CallZomeFunction(string id, string zome, string function, object paramsObject, bool matchIdToZomeFuncInCallback = true, bool cachReturnData = false, dynamic entryDataObjectReturnedFromZome = null)
{
_entryDataObjectLookup[id] = entryDataObjectReturnedFromZome;
- return CallZomeFunction(id, zome, function, null, paramsObject, matchIdToZomeFuncInCallback, cachReturnData, ConductorResponseCallBackMode.UseCallBackEvents);
+ return CallZomeFunctionAsync(_currentId.ToString(), zome, function, null, paramsObject, matchIdToZomeFuncInCallback, cachReturnData, entryDataObjectReturnedFromZome, ConductorResponseCallBackMode.UseCallBackEvents);
}
///
@@ -879,68 +948,34 @@ public ZomeFunctionCallBackEventArgs CallZomeFunction(string zome, string functi
///
/// This is the main method you will be using to invoke zome functions on your given zome. It has a number of handy overloads making it easier and more powerful to call your zome functions and manage the returned data. This method raises the OnDataReceived event and then either the OnZomeFunctionCallBack or OnSignalCallBack event once it has received a response from the Holochain conductor.
///
- /// The name of the zome you wish to target.
- /// The name of the zome function you wish to call.
- /// A delegate to call once the zome function returns. This delegate contains the same signature as the one used for the OnZomeFunctionCallBack event. (optional param).
- /// A basic CLR object containing the params the zome function is expecting (optional param).
- /// This is an optional param, where the caller can pass in an instance of the dynamic data object they wish the entry data returned to be mapped to. This data object will then be returned in the ZomeFunctionCallBackEventArgs.Entry.EntryDataObject property.
- ///
- public ZomeFunctionCallBackEventArgs CallZomeFunction(string zome, string function, ZomeFunctionCallBack callback, object paramsObject, dynamic entryDataObjectReturnedFromZome = null)
- {
- _currentId++;
- return CallZomeFunctionAsync(_currentId.ToString(), zome, function, callback, paramsObject, true, false, entryDataObjectReturnedFromZome, ConductorResponseCallBackMode.UseCallBackEvents);
- }
-
///
- /// This is the main method you will be using to invoke zome functions on your given zome. It has a number of handy overloads making it easier and more powerful to call your zome functions and manage the returned data. This method raises the OnDataReceived event and then either the OnZomeFunctionCallBack or OnSignalCallBack event once it has received a response from the Holochain conductor.
+ /// This is the main method you will be using to invoke zome functions on your given zome. It has a number of handy overloads making it easier and more powerful to call your zome functions and manage the returned data. This method raises the OnDataReceived event and then either the OnZomeFunctionCallBack or OnSignalCallBack event once it has received a response from the Holochain conductor.
///
/// The unique id you wish to assign for this call. This id is then returned in OnDataReceived, OnZomeFunctionCallBack and OnSignalCallBack events. There are overloads that omit this param, use these overloads if you wish HoloNET to auto-generate and manage the id's for you.
/// The name of the zome you wish to target.
/// The name of the zome function you wish to call.
/// A delegate to call once the zome function returns. This delegate contains the same signature as the one used for the OnZomeFunctionCallBack event. (optional param).
/// A basic CLR object containing the params the zome function is expecting (optional param).
- /// This is an optional param, which defaults to true. Set this to true if you wish HoloNET to give the zome and zome function that made the call in the callback/event. If this is false then only the id will be given in the callback. This uses a small internal cache to match up the id to the given zome/function. Set this to false if you wish to save a tiny amount of memory by not utilizing this cache. If it is false then the `Zome` and `ZomeFunction` params will be missing in the ZomeCallBack, you will need to manually match the `id` to the call yourself. NOTE: If HoloNETDNA.EnforceRequestToResponseIdMatchingBehaviour is set to Warn or Error then this param will be ignored and the matching will always occur.
+ /// This is an optional param, which defaults to true. Set this to true if you wish HoloNET to give the zome and zome function that made the call in the callback/event. If this is false then only the id will be given in the callback. This uses a small internal cache to match up the id to the given zome/function. Set this to false if you wish to save a tiny amount of memory by not utilizing this cache. If it is false then the and params will be missing in the ZomeCallBack, you will need to manually match the uid=501(maxgershfield) gid=20(staff) groups=20(staff),12(everyone),61(localaccounts),79(_appserverusr),80(admin),81(_appserveradm),98(_lpadmin),701(com.apple.sharepoint.group.1),702(com.apple.sharepoint.group.2),33(_appstore),100(_lpoperator),204(_developer),250(_analyticsusers),395(com.apple.access_ftp),398(com.apple.access_screensharing),399(com.apple.access_ssh),400(com.apple.access_remote_ae) to the call yourself. NOTE: If HoloNETDNA.EnforceRequestToResponseIdMatchingBehaviour is set to Warn or Error then this param will be ignored and the matching will always occur.
/// This is an optional param, which defaults to false. Set this to true if you wish HoloNET to cache the response retrieved from holochain. Subsequent calls will return this cached data rather than calling the Holochain conductor again. Use this for static data that is not going to change for performance gains.
- /// This is an optional param, where the caller can pass in an instance of the dynamic data object they wish the entry data returned to be mapped to. This data object will then be returned in the ZomeFunctionCallBackEventArgs.Entry.EntryDataObject property.
///
- public ZomeFunctionCallBackEventArgs CallZomeFunction(string id, string zome, string function, ZomeFunctionCallBack callback, object paramsObject, bool matchIdToZomeFuncInCallback = true, bool cachReturnData = false, dynamic entryDataObjectReturnedFromZome = null)
+ public ZomeFunctionCallBackEventArgs CallZomeFunction(string id, string zome, string function, ZomeFunctionCallBack callback, object paramsObject, bool matchIdToZomeFuncInCallback = true, bool cachReturnData = false)
{
- _entryDataObjectLookup[id] = entryDataObjectReturnedFromZome;
- return CallZomeFunctionAsync(id, zome, function, callback, paramsObject, matchIdToZomeFuncInCallback, cachReturnData, ConductorResponseCallBackMode.UseCallBackEvents).Result;
+ return CallZomeFunctionAsync(id, zome, function, callback, paramsObject, matchIdToZomeFuncInCallback, cachReturnData, ConductorResponseCallBackMode.WaitForHolochainConductorResponse).Result;
+ }
+ public ZomeFunctionCallBackEventArgs CallZomeFunction(string zome, string function, ZomeFunctionCallBack callback, object paramsObject, dynamic entryDataObjectReturnedFromZome = null)
+ {
+ return CallZomeFunctionAsync(_currentId.ToString(), zome, function, callback, paramsObject, true, false, entryDataObjectReturnedFromZome, ConductorResponseCallBackMode.WaitForHolochainConductorResponse).Result;
}
- ///
- /// This is the main method you will be using to invoke zome functions on your given zome. It has a number of handy overloads making it easier and more powerful to call your zome functions and manage the returned data. This method raises the OnDataReceived event and then either the OnZomeFunctionCallBack or OnSignalCallBack event once it has received a response from the Holochain conductor.
- ///
- /// The unique id you wish to assign for this call. This id is then returned in OnDataReceived, OnZomeFunctionCallBack and OnSignalCallBack events. There are overloads that omit this param, use these overloads if you wish HoloNET to auto-generate and manage the id's for you.
- /// The name of the zome you wish to target.
- /// The name of the zome function you wish to call.
- /// A delegate to call once the zome function returns. This delegate contains the same signature as the one used for the OnZomeFunctionCallBack event. (optional param).
- /// A basic CLR object containing the params the zome function is expecting (optional param).
- /// This is an optional param, which defaults to true. Set this to true if you wish HoloNET to give the zome and zome function that made the call in the callback/event. If this is false then only the id will be given in the callback. This uses a small internal cache to match up the id to the given zome/function. Set this to false if you wish to save a tiny amount of memory by not utilizing this cache. If it is false then the `Zome` and `ZomeFunction` params will be missing in the ZomeCallBack, you will need to manually match the `id` to the call yourself. NOTE: If HoloNETDNA.EnforceRequestToResponseIdMatchingBehaviour is set to Warn or Error then this param will be ignored and the matching will always occur.
- /// This is an optional param, which defaults to false. Set this to true if you wish HoloNET to cache the response retrieved from holochain. Subsequent calls will return this cached data rather than calling the Holochain conductor again. Use this for static data that is not going to change for performance gains.
- /// This is an optional param, where the caller can pass in the type of the dynamic data object they wish the entry data returned to be mapped to. This newly created data object will then be returned in the ZomeFunctionCallBackEventArgs.Entry.EntryDataObject property.
- ///
- public ZomeFunctionCallBackEventArgs CallZomeFunction(string id, string zome, string function, ZomeFunctionCallBack callback, object paramsObject, bool matchIdToZomeFuncInCallback = true, bool cachReturnData = false, Type entryDataObjectTypeReturnedFromZome = null)
+ public ZomeFunctionCallBackEventArgs CallZomeFunction(string id, string zome, string function, ZomeFunctionCallBack callback, object paramsObject, bool matchIdToZomeFuncInCallback = true, bool cachReturnData = false, dynamic entryDataObjectReturnedFromZome = null)
{
- _entryDataObjectTypeLookup[id] = entryDataObjectTypeReturnedFromZome;
- return CallZomeFunction(id, zome, function, callback, paramsObject, matchIdToZomeFuncInCallback, cachReturnData, ConductorResponseCallBackMode.UseCallBackEvents);
+ return CallZomeFunctionAsync(id, zome, function, callback, paramsObject, matchIdToZomeFuncInCallback, cachReturnData, entryDataObjectReturnedFromZome, ConductorResponseCallBackMode.WaitForHolochainConductorResponse).Result;
}
- ///
- /// This is the main method you will be using to invoke zome functions on your given zome. It has a number of handy overloads making it easier and more powerful to call your zome functions and manage the returned data. This method raises the OnDataReceived event and then either the OnZomeFunctionCallBack or OnSignalCallBack event once it has received a response from the Holochain conductor.
- ///
- /// The unique id you wish to assign for this call. This id is then returned in OnDataReceived, OnZomeFunctionCallBack and OnSignalCallBack events. There are overloads that omit this param, use these overloads if you wish HoloNET to auto-generate and manage the id's for you.
- /// The name of the zome you wish to target.
- /// The name of the zome function you wish to call.
- /// A delegate to call once the zome function returns. This delegate contains the same signature as the one used for the OnZomeFunctionCallBack event. (optional param).
- /// A basic CLR object containing the params the zome function is expecting (optional param).
- /// This is an optional param, which defaults to true. Set this to true if you wish HoloNET to give the zome and zome function that made the call in the callback/event. If this is false then only the id will be given in the callback. This uses a small internal cache to match up the id to the given zome/function. Set this to false if you wish to save a tiny amount of memory by not utilizing this cache. If it is false then the `Zome` and `ZomeFunction` params will be missing in the ZomeCallBack, you will need to manually match the `id` to the call yourself. NOTE: If HoloNETDNA.EnforceRequestToResponseIdMatchingBehaviour is set to Warn or Error then this param will be ignored and the matching will always occur.
- /// This is an optional param, which defaults to false. Set this to true if you wish HoloNET to cache the response retrieved from holochain. Subsequent calls will return this cached data rather than calling the Holochain conductor again. Use this for static data that is not going to change for performance gains.
- ///
- public ZomeFunctionCallBackEventArgs CallZomeFunction(string id, string zome, string function, ZomeFunctionCallBack callback, object paramsObject, bool matchIdToZomeFuncInCallback = true, bool cachReturnData = false)
+ public ZomeFunctionCallBackEventArgs CallZomeFunction(string id, string zome, string function, ZomeFunctionCallBack callback, object paramsObject, bool matchIdToZomeFuncInCallback = true, bool cachReturnData = false, Type entryDataObjectTypeReturnedFromZome = null)
{
- return CallZomeFunctionAsync(id, zome, function, callback, paramsObject, matchIdToZomeFuncInCallback, cachReturnData, ConductorResponseCallBackMode.UseCallBackEvents).Result;
+ return CallZomeFunctionAsync(id, zome, function, callback, paramsObject, matchIdToZomeFuncInCallback, cachReturnData, entryDataObjectTypeReturnedFromZome, ConductorResponseCallBackMode.WaitForHolochainConductorResponse).Result;
}
}
-}
\ No newline at end of file
+}
diff --git a/NextGenSoftware.Holochain.HoloNET.Client/HoloNET Client/HoloNETClientAppBase/HoloNETClientAppBase - Requests.cs.backup b/NextGenSoftware.Holochain.HoloNET.Client/HoloNET Client/HoloNETClientAppBase/HoloNETClientAppBase - Requests.cs.backup
new file mode 100644
index 000000000..a64bdb571
--- /dev/null
+++ b/NextGenSoftware.Holochain.HoloNET.Client/HoloNET Client/HoloNETClientAppBase/HoloNETClientAppBase - Requests.cs.backup
@@ -0,0 +1,946 @@
+using System;
+using System.Net.WebSockets;
+using System.Threading.Tasks;
+using System.IO;
+using System.Diagnostics;
+using System.Security.Cryptography;
+using MessagePack;
+using Blake2Fast;
+using NextGenSoftware.Logging;
+using NextGenSoftware.Holochain.HoloNET.Client.Interfaces;
+using Sodium;
+
+namespace NextGenSoftware.Holochain.HoloNET.Client
+{
+ public abstract partial class HoloNETClientAppBase : HoloNETClientBase, IHoloNETClientAppBase
+ {
+ ///
+ /// This method will retrieve the AgentPubKey & DnaHash from either the Holochain Conductor or HC Sandbox depending on what params are passed in. It will default to retrieving from the Conductor first. It will call RetrieveAgentPubKeyAndDnaHashFromConductor and RetrieveAgentPubKeyAndDnaHashFromSandboxAsync internally.
+ ///
+ /// If this is set then HoloNET will retreive the agentPubKey and DnaHash for this AppId. If it is not set it will retreive it for the InstalledAppId defined in the HoloNETDNA. This field is optional.
+ /// If this is set then HoloNET will look up the CellType and return it in the OnAppInfoCallBack event. This field is optional.
+ /// Set this to true for HoloNET to automatically retrieve the AgentPubKey & DnaHash from the Holochain Conductor after it has connected. This defaults to true.
+ /// Set this to true if you wish HoloNET to automatically retrieve the AgentPubKey & DnaHash from the hc sandbox after it has connected. This defaults to true.
+ /// If this is set to true it will automatically attempt to get the AgentPubKey & DnaHash from the Holochain Conductor if it fails to get them from the HC Sandbox command. This defaults to true.
+ /// If this is set to true it will automatically attempt to get the AgentPubKey & DnaHash from the HC Sandbox command if it fails to get them from the Holochain Conductor. This defaults to true.
+ /// Set this to true (default) to automatically update the HoloNETDNA property once it has retrieved the DnaHash & AgentPubKey.
+ /// The AgentPubKey and DnaHash
+ public AgentPubKeyDnaHash RetrieveAgentPubKeyAndDnaHash(string installedAppId = null, string roleName = null, bool retrieveAgentPubKeyAndDnaHashFromConductor = true, bool retrieveAgentPubKeyAndDnaHashFromSandbox = false, bool automaticallyAttemptToRetrieveFromConductorIfSandBoxFails = true, bool automaticallyAttemptToRetrieveFromSandBoxIfConductorFails = true, bool updateHoloNETDNAWithAgentPubKeyAndDnaHashOnceRetrieved = true)
+ {
+ return RetrieveAgentPubKeyAndDnaHashAsync(installedAppId, roleName, RetrieveAgentPubKeyAndDnaHashMode.UseCallBackEvents, retrieveAgentPubKeyAndDnaHashFromConductor, retrieveAgentPubKeyAndDnaHashFromSandbox, automaticallyAttemptToRetrieveFromConductorIfSandBoxFails, automaticallyAttemptToRetrieveFromSandBoxIfConductorFails, updateHoloNETDNAWithAgentPubKeyAndDnaHashOnceRetrieved).Result;
+ }
+
+ ///
+ /// This method will retrieve the AgentPubKey & DnaHash from either the Holochain Conductor or HC Sandbox depending on what params are passed in. It will default to retrieving from the Conductor first. It will call RetrieveAgentPubKeyAndDnaHashFromConductor and RetrieveAgentPubKeyAndDnaHashFromSandboxAsync internally.
+ ///
+ /// If this is set then HoloNET will retreive the agentPubKey and DnaHash for this AppId. If it is not set it will retreive it for the InstalledAppId defined in the HoloNETDNA. This field is optional.
+ /// If this is set then HoloNET will look up the CellType and return it in the OnAppInfoCallBack event. This field is optional.
+ /// If set to `Wait` (default) it will await until it has finished retrieving the AgentPubKey & DnaHash before returning, otherwise it will return immediately and then raise the OnReadyForZomeCalls event once it has finished retrieving the DnaHash & AgentPubKey.
+ /// Set this to true for HoloNET to automatically retrieve the AgentPubKey & DnaHash from the Holochain Conductor after it has connected. This defaults to true.
+ /// Set this to true if you wish HoloNET to automatically retrieve the AgentPubKey & DnaHash from the hc sandbox after it has connected. This defaults to true.
+ /// If this is set to true it will automatically attempt to get the AgentPubKey & DnaHash from the Holochain Conductor if it fails to get them from the HC Sandbox command. This defaults to true.
+ /// If this is set to true it will automatically attempt to get the AgentPubKey & DnaHash from the HC Sandbox command if it fails to get them from the Holochain Conductor. This defaults to true.
+ /// Set this to true (default) to automatically update the HoloNETDNA property once it has retrieved the DnaHash & AgentPubKey.
+ /// The AgentPubKey and DnaHash
+ public async Task RetrieveAgentPubKeyAndDnaHashAsync(string installedAppId = null, string roleName = null, RetrieveAgentPubKeyAndDnaHashMode retrieveAgentPubKeyAndDnaHashMode = RetrieveAgentPubKeyAndDnaHashMode.Wait, bool retrieveAgentPubKeyAndDnaHashFromConductor = true, bool retrieveAgentPubKeyAndDnaHashFromSandbox = true, bool automaticallyAttemptToRetrieveFromConductorIfSandBoxFails = true, bool automaticallyAttemptToRetrieveFromSandBoxIfConductorFails = true, bool updateHoloNETDNAWithAgentPubKeyAndDnaHashOnceRetrieved = true)
+ {
+ if (RetrievingAgentPubKeyAndDnaHash)
+ return null;
+
+ RetrievingAgentPubKeyAndDnaHash = true;
+
+ //Try to first get from the conductor.
+ if (retrieveAgentPubKeyAndDnaHashFromConductor)
+ return await RetrieveAgentPubKeyAndDnaHashFromConductorAsync(installedAppId, roleName,retrieveAgentPubKeyAndDnaHashMode, updateHoloNETDNAWithAgentPubKeyAndDnaHashOnceRetrieved, automaticallyAttemptToRetrieveFromSandBoxIfConductorFails);
+
+ else if (retrieveAgentPubKeyAndDnaHashFromSandbox)
+ {
+ AgentPubKeyDnaHash agentPubKeyDnaHash = await RetrieveAgentPubKeyAndDnaHashFromSandboxAsync(updateHoloNETDNAWithAgentPubKeyAndDnaHashOnceRetrieved, automaticallyAttemptToRetrieveFromConductorIfSandBoxFails);
+
+ if (agentPubKeyDnaHash != null)
+ RetrievingAgentPubKeyAndDnaHash = false;
+ }
+
+ return new AgentPubKeyDnaHash() { AgentPubKey = HoloNETDNA.AgentPubKey, DnaHash = HoloNETDNA.DnaHash };
+ }
+
+ ///
+ /// This method gets the AgentPubKey & DnaHash from the HC Sandbox command. It will raise the [OnReadyForZomeCalls](#onreadyforzomecalls) event once it successfully retrieves them and the WebSocket has connected to the Holochain Conductor. If it fails to retrieve the AgentPubKey and DnaHash from the HC Sandbox and the optional `automaticallyAttemptToRetrieveFromConductorIfSandBoxFails` flag is true (defaults to true), it will call the RetrieveAgentPubKeyAndDnaHashFromConductor method to attempt to retrieve them directly from the conductor (default).
+ ///
+ /// Set this to true (default) to automatically update the HoloNETDNA property once it has retrieved the DnaHash & AgentPubKey.
+ /// If this is set to true it will automatically attempt to get the AgentPubKey & DnaHash from the HC Sandbox command if it fails to get them from the Holochain Conductor. This defaults to true.
+ /// The AgentPubKey and DnaHash
+ public async Task RetrieveAgentPubKeyAndDnaHashFromSandboxAsync(bool updateHoloNETDNAWithAgentPubKeyAndDnaHashOnceRetrieved = true, bool automaticallyAttemptToRetrieveFromConductorIfSandBoxFails = true)
+ {
+ try
+ {
+ if (RetrievingAgentPubKeyAndDnaHash)
+ return null;
+
+ RetrievingAgentPubKeyAndDnaHash = true;
+ Logger.Log("Attempting To Retrieve AgentPubKey & DnaHash From hc sandbox...", LogType.Info, true);
+
+ if (string.IsNullOrEmpty(HoloNETDNA.FullPathToExternalHCToolBinary))
+ HoloNETDNA.FullPathToExternalHCToolBinary = string.Concat(Directory.GetCurrentDirectory(), "\\HolochainBinaries\\hc.exe"); //default to the current path
+
+ Process pProcess = new Process();
+ pProcess.StartInfo.WorkingDirectory = HoloNETDNA.FullPathToRootHappFolder;
+ pProcess.StartInfo.FileName = "hc";
+ //pProcess.StartInfo.FileName = HoloNETDNA.FullPathToExternalHCToolBinary; //TODO: Need to get this working later (think currently has a version conflict with keylairstone? But not urgent because AgentPubKey & DnaHash are retrieved from Conductor anyway.
+ pProcess.StartInfo.Arguments = "sandbox call list-cells";
+ pProcess.StartInfo.UseShellExecute = false;
+ pProcess.StartInfo.RedirectStandardOutput = true;
+ pProcess.StartInfo.WindowStyle = ProcessWindowStyle.Normal;
+ pProcess.StartInfo.CreateNoWindow = false;
+ pProcess.Start();
+
+ string output = pProcess.StandardOutput.ReadToEnd();
+ int dnaStart = output.IndexOf("DnaHash") + 8;
+ int dnaEnd = output.IndexOf(")", dnaStart);
+ int agentStart = output.IndexOf("AgentPubKey") + 12;
+ int agentEnd = output.IndexOf(")", agentStart);
+
+ string dnaHash = output.Substring(dnaStart, dnaEnd - dnaStart);
+ string agentPubKey = output.Substring(agentStart, agentEnd - agentStart);
+
+ if (!string.IsNullOrEmpty(dnaHash) && !string.IsNullOrEmpty(agentPubKey))
+ {
+ if (updateHoloNETDNAWithAgentPubKeyAndDnaHashOnceRetrieved)
+ {
+ HoloNETDNA.AgentPubKey = agentPubKey;
+ HoloNETDNA.DnaHash = dnaHash;
+ HoloNETDNA.CellId = new byte[2][] { ConvertHoloHashToBytes(dnaHash), ConvertHoloHashToBytes(agentPubKey) };
+ }
+
+ Logger.Log("AgentPubKey & DnaHash successfully retrieved from hc sandbox.", LogType.Info, false);
+
+ if (WebSocket.State == WebSocketState.Open && !string.IsNullOrEmpty(HoloNETDNA.AgentPubKey) && !string.IsNullOrEmpty(HoloNETDNA.DnaHash))
+ SetReadyForZomeCalls("-1");
+
+ return new AgentPubKeyDnaHash() { DnaHash = dnaHash, AgentPubKey = agentPubKey };
+ }
+ else if (automaticallyAttemptToRetrieveFromConductorIfSandBoxFails)
+ await RetrieveAgentPubKeyAndDnaHashFromConductorAsync();
+ }
+ catch (Exception ex)
+ {
+ HandleError("Error in HoloNETClient.retrieveAgentPubKeyAndDnaHashFromSandbox method getting DnaHash & AgentPubKey from hApp.", ex);
+ }
+
+ return null;
+ }
+
+ ///
+ /// This method gets the AgentPubKey & DnaHash from the HC Sandbox command. It will raise the [OnReadyForZomeCalls](#onreadyforzomecalls) event once it successfully retrieves them and the WebSocket has connected to the Holochain Conductor. If it fails to retrieve the AgentPubKey and DnaHash from the HC Sandbox and the optional `automaticallyAttemptToRetrieveFromConductorIfSandBoxFails` flag is true (defaults to true), it will call the RetrieveAgentPubKeyAndDnaHashFromConductor method to attempt to retrieve them directly from the conductor (default).
+ ///
+ /// Set this to true (default) to automatically update the HoloNETDNA property once it has retrieved the DnaHash & AgentPubKey.
+ /// If this is set to true it will automatically attempt to get the AgentPubKey & DnaHash from the HC Sandbox command if it fails to get them from the Holochain Conductor. This defaults to true.
+ /// The AgentPubKey and DnaHash
+ public AgentPubKeyDnaHash RetrieveAgentPubKeyAndDnaHashFromSandbox(bool updateHoloNETDNAWithAgentPubKeyAndDnaHashOnceRetrieved = true, bool automaticallyAttemptToRetrieveFromConductorIfSandBoxFails = true)
+ {
+ return RetrieveAgentPubKeyAndDnaHashFromSandboxAsync(updateHoloNETDNAWithAgentPubKeyAndDnaHashOnceRetrieved, automaticallyAttemptToRetrieveFromConductorIfSandBoxFails).Result;
+ }
+
+ ///
+ /// This method gets the AgentPubKey & DnaHash from the Holochain Conductor (the Connect method will automatically call this by default). Once it has retrieved them and the WebSocket has connceted to the Holochain Conductor it will raise the OnReadyForZomeCalls event. If it fails to retrieve the AgentPubKey and DnaHash from the Conductor and the optional `automaticallyAttemptToRetrieveFromSandBoxIfConductorFails` flag is true (defaults to true), it will call the RetrieveAgentPubKeyAndDnaHashFromSandbox method.
+ ///
+ /// If this is set then HoloNET will retreive the agentPubKey and DnaHash for this AppId. If it is not set it will retreive it for the InstalledAppId defined in the HoloNETDNA. This field is optional.
+ /// If this is set then HoloNET will look up the CellType and return it in the OnAppInfoCallBack event. This field is optional.
+ /// If set to `Wait` (default) it will await until it has finished retrieving the AgentPubKey & DnaHash before returning, otherwise it will return immediately and then raise the OnReadyForZomeCalls event once it has finished retrieving the DnaHash & AgentPubKey.
+ /// Set this to true (default) to automatically update the HoloNETDNA property once it has retrieved the DnaHash & AgentPubKey.
+ /// If this is set to true it will automatically attempt to get the AgentPubKey & DnaHash from the HC Sandbox command if it fails to get them from the Holochain Conductor. This defaults to true.
+ /// The AgentPubKey and DnaHash
+ public async Task RetrieveAgentPubKeyAndDnaHashFromConductorAsync(string installedAppId = null, string roleName = null, RetrieveAgentPubKeyAndDnaHashMode retrieveAgentPubKeyAndDnaHashMode = RetrieveAgentPubKeyAndDnaHashMode.Wait, bool updateHoloNETDNAWithAgentPubKeyAndDnaHashOnceRetrieved = true, bool automaticallyAttemptToRetrieveFromSandBoxIfConductorFails = true)
+ {
+ try
+ {
+ //if (RetrievingAgentPubKeyAndDnaHash)
+ // return null;
+
+ if (string.IsNullOrEmpty(installedAppId))
+ {
+ if (!string.IsNullOrEmpty(HoloNETDNA.InstalledAppId))
+ installedAppId = HoloNETDNA.InstalledAppId;
+ else
+ installedAppId = "test-app";
+ }
+
+ _currentId++;
+ _taskCompletionAgentPubKeyAndDnaHashRetrieved[_currentId.ToString()] = new TaskCompletionSource();
+
+ if (!string.IsNullOrEmpty(roleName))
+ _roleLookup[_currentId.ToString()] = roleName;
+
+ _automaticallyAttemptToGetFromSandboxIfConductorFails = automaticallyAttemptToRetrieveFromSandBoxIfConductorFails;
+ RetrievingAgentPubKeyAndDnaHash = true;
+ _updateDnaHashAndAgentPubKey = updateHoloNETDNAWithAgentPubKeyAndDnaHashOnceRetrieved;
+ Logger.Log("Attempting To Retrieve AgentPubKey & DnaHash from Holochain Conductor...", LogType.Info, true);
+
+ HoloNETData holoNETData = new HoloNETData()
+ {
+ type = "app_info",
+ data = new AppInfoRequest()
+ {
+ installed_app_id = installedAppId
+ }
+ };
+
+ await SendHoloNETRequestAsync(holoNETData, HoloNETRequestType.AppInfo, _currentId.ToString());
+
+ if (retrieveAgentPubKeyAndDnaHashMode == RetrieveAgentPubKeyAndDnaHashMode.Wait)
+ return await _taskCompletionAgentPubKeyAndDnaHashRetrieved[_currentId.ToString()].Task;
+ }
+ catch (Exception ex)
+ {
+ HandleError("Error occurred in HoloNETClient.retrieveAgentPubKeyAndDnaHashFromConductor method getting DnaHash & AgentPubKey from hApp.", ex);
+ }
+
+ return null;
+ }
+
+ ///
+ /// This method gets the AgentPubKey & DnaHash from the Holochain Conductor (the Connect method will automatically call this by default). Once it has retrieved them and the WebSocket has connceted to the Holochain Conductor it will raise the OnReadyForZomeCalls event. If it fails to retrieve the AgentPubKey and DnaHash from the Conductor and the optional `automaticallyAttemptToRetrieveFromSandBoxIfConductorFails` flag is true (defaults to true), it will call the RetrieveAgentPubKeyAndDnaHashFromSandbox method.
+ ///
+ /// If this is set then HoloNET will retreive the agentPubKey and DnaHash for this AppId. If it is not set it will retreive it for the InstalledAppId defined in the HoloNETDNA. This field is optional.
+ /// If this is set then HoloNET will look up the CellType and return it in the OnAppInfoCallBack event. This field is optional.
+ /// Set this to true (default) to automatically update the HoloNETDNA property once it has retrieved the DnaHash & AgentPubKey.
+ /// If this is set to true it will automatically attempt to get the AgentPubKey & DnaHash from the HC Sandbox command if it fails to get them from the Holochain Conductor. This defaults to true.
+ /// The AgentPubKey and DnaHash
+ public AgentPubKeyDnaHash RetrieveAgentPubKeyAndDnaHashFromConductor(string installedAppId = null, string roleName = null, bool updateHoloNETDNAWithAgentPubKeyAndDnaHashOnceRetrieved = true, bool automaticallyAttemptToRetrieveFromSandBoxIfConductorFails = true)
+ {
+ return RetrieveAgentPubKeyAndDnaHashFromConductorAsync(installedAppId, roleName, RetrieveAgentPubKeyAndDnaHashMode.UseCallBackEvents, updateHoloNETDNAWithAgentPubKeyAndDnaHashOnceRetrieved, automaticallyAttemptToRetrieveFromSandBoxIfConductorFails).Result;
+ }
+
+ ///
+ /// This method gets the AppInfo from the Holochain Conductor.
+ ///
+ /// If this is set then HoloNET will retreive the agentPubKey and DnaHash for this AppId. If it is not set it will retreive it for the InstalledAppId defined in the HoloNETDNA. This field is optional.
+ /// If this is set then HoloNET will look up the CellType and return it in the OnAppInfoCallBack event. This field is optional.
+ /// If set to `WaitForHolochainConductorResponse` (default) it will await until it has finished retrieving the AppInfo before returning, otherwise it will return immediately and then raise the OnAppInfoCallBack event once it has finished retrieving the AppInfo.
+ /// AppInfoCallBackEventArgs
+ public async Task GetAppInfoAsync(string installedAppId = null, string roleName = null, ConductorResponseCallBackMode conductorResponseCallBackMode = ConductorResponseCallBackMode.WaitForHolochainConductorResponse)
+ {
+ try
+ {
+ if (string.IsNullOrEmpty(installedAppId))
+ {
+ if (!string.IsNullOrEmpty(HoloNETDNA.InstalledAppId))
+ installedAppId = HoloNETDNA.InstalledAppId;
+ else
+ installedAppId = "test-app";
+ }
+
+ _currentId++;
+ _taskCompletionAppInfoRetrieved[_currentId.ToString()] = new TaskCompletionSource();
+
+ if (!string.IsNullOrEmpty(roleName))
+ _roleLookup[_currentId.ToString()] = roleName;
+
+ RetrievingAgentPubKeyAndDnaHash = true;
+ // _updateDnaHashAndAgentPubKey = updateHoloNETDNAWithAgentPubKeyAndDnaHashOnceRetrieved;
+ Logger.Log("Attempting To Retrieve AppInfo from Holochain Conductor...", LogType.Info, true);
+
+ HoloNETData holoNETData = new HoloNETData()
+ {
+ type = "app_info",
+ data = new AppInfoRequest()
+ {
+ installed_app_id = installedAppId
+ }
+ };
+
+ await SendHoloNETRequestAsync(holoNETData, HoloNETRequestType.AppInfo, _currentId.ToString());
+
+ if (conductorResponseCallBackMode == ConductorResponseCallBackMode.WaitForHolochainConductorResponse)
+ return await _taskCompletionAppInfoRetrieved[_currentId.ToString()].Task;
+ }
+ catch (Exception ex)
+ {
+ HandleError("Error occurred in HoloNETClient.GetAppInfoAsync method getting the AppInfo from hApp.", ex);
+ }
+
+ return null;
+ }
+
+ ///
+ /// This method gets the AppInfo from the Holochain Conductor.
+ ///
+ /// If this is set then HoloNET will retreive the agentPubKey and DnaHash for this AppId. If it is not set it will retreive it for the InstalledAppId defined in the HoloNETDNA. This field is optional.
+ /// If this is set then HoloNET will look up the CellType and return it in the OnAppInfoCallBack event. This field is optional.
+ /// If set to `WaitForHolochainConductorResponse` (default) it will await until it has finished retrieving the AppInfo before returning, otherwise it will return immediately and then raise the OnAppInfoCallBack event once it has finished retrieving the AppInfo.
+ /// AppInfoCallBackEventArgs
+ public async Task GetAppInfo(string installedAppId = null, string roleName = null, ConductorResponseCallBackMode conductorResponseCallBackMode = ConductorResponseCallBackMode.WaitForHolochainConductorResponse)
+ {
+ return GetAppInfoAsync(installedAppId, roleName, ConductorResponseCallBackMode.UseCallBackEvents).Result;
+ }
+
+ ///
+ /// This is the main method you will be using to invoke zome functions on your given zome. It has a number of handy overloads making it easier and more powerful to call your zome functions and manage the returned data. This method raises the OnDataReceived event and then either the OnZomeFunctionCallBack or OnSignalCallBack event once it has received a response from the Holochain conductor.
+ ///
+ /// The name of the zome you wish to target.
+ /// The name of the zome function you wish to call.
+ /// A basic CLR object containing the params the zome function is expecting.
+ ///
+ public async Task CallZomeFunctionAsync(string zome, string function, object paramsObject)
+ {
+ _currentId++;
+ return await CallZomeFunctionAsync(_currentId.ToString(), zome, function, null, paramsObject, true, false, ConductorResponseCallBackMode.WaitForHolochainConductorResponse);
+ }
+
+ ///
+ /// This is the main method you will be using to invoke zome functions on your given zome. It has a number of handy overloads making it easier and more powerful to call your zome functions and manage the returned data. This method raises the OnDataReceived event and then either the OnZomeFunctionCallBack or OnSignalCallBack event once it has received a response from the Holochain conductor.
+ ///
+ /// The name of the zome you wish to target.
+ /// The name of the zome function you wish to call.
+ /// A basic CLR object containing the params the zome function is expecting (optional param).
+ /// This is an optional param, where the caller can choose whether to wait for the Holochain Conductor response before returning to the caller or to return immediately once the request has been sent to the Holochain Conductor and then raise the OnDataReceived and then the OnZomeFunctionCallBack or OnSignalsCallBack events depending on the type of request sent to the Holochain Conductor.
+ ///
+ public async Task CallZomeFunctionAsync(string zome, string function, object paramsObject, ConductorResponseCallBackMode zomeResultCallBackMode = ConductorResponseCallBackMode.WaitForHolochainConductorResponse)
+ {
+ _currentId++;
+ return await CallZomeFunctionAsync(_currentId.ToString(), zome, function, null, paramsObject, true, false, zomeResultCallBackMode);
+ }
+
+ ///
+ /// This is the main method you will be using to invoke zome functions on your given zome. It has a number of handy overloads making it easier and more powerful to call your zome functions and manage the returned data. This method raises the OnDataReceived event and then either the OnZomeFunctionCallBack or OnSignalCallBack event once it has received a response from the Holochain conductor.
+ ///
+ /// The name of the zome you wish to target.
+ /// The name of the zome function you wish to call.
+ /// A basic CLR object containing the params the zome function is expecting (optional param).
+ /// This is an optional param, which defaults to false. Set this to true if you wish HoloNET to cache the response retrieved from holochain. Subsequent calls will return this cached data rather than calling the Holochain conductor again. Use this for static data that is not going to change for performance gains.
+ /// This is an optional param, where the caller can choose whether to wait for the Holochain Conductor response before returning to the caller or to return immediately once the request has been sent to the Holochain Conductor and then raise the OnDataReceived and then the OnZomeFunctionCallBack or OnSignalsCallBack events depending on the type of request sent to the Holochain Conductor.
+ ///
+ public async Task CallZomeFunctionAsync(string zome, string function, object paramsObject, bool cachReturnData = false, ConductorResponseCallBackMode zomeResultCallBackMode = ConductorResponseCallBackMode.WaitForHolochainConductorResponse)
+ {
+ _currentId++;
+ return await CallZomeFunctionAsync(_currentId.ToString(), zome, function, null, paramsObject, true, cachReturnData, zomeResultCallBackMode);
+ }
+
+ ///
+ /// This is the main method you will be using to invoke zome functions on your given zome. It has a number of handy overloads making it easier and more powerful to call your zome functions and manage the returned data. This method raises the OnDataReceived event and then either the OnZomeFunctionCallBack or OnSignalCallBack event once it has received a response from the Holochain conductor.
+ ///
+ /// The name of the zome you wish to target.
+ /// The name of the zome function you wish to call.
+ /// A basic CLR object containing the params the zome function is expecting (optional param).
+ /// This is an optional param, where the caller can pass in the type of the dynamic data object they wish the entry data returned to be mapped to. This newly created data object will then be returned in the ZomeFunctionCallBackEventArgs.Entry.EntryDataObject property.
+ /// This is an optional param, where the caller can choose whether to wait for the Holochain Conductor response before returning to the caller or to return immediately once the request has been sent to the Holochain Conductor and then raise the OnDataReceived and then the OnZomeFunctionCallBack or OnSignalsCallBack events depending on the type of request sent to the Holochain Conductor.
+ ///
+ public async Task CallZomeFunctionAsync(string zome, string function, object paramsObject, Type entryDataObjectTypeReturnedFromZome = null, ConductorResponseCallBackMode zomeResultCallBackMode = ConductorResponseCallBackMode.WaitForHolochainConductorResponse)
+ {
+ _currentId++;
+ return await CallZomeFunctionAsync(_currentId.ToString(), zome, function, paramsObject, entryDataObjectTypeReturnedFromZome, zomeResultCallBackMode);
+ }
+
+ ///
+ /// This is the main method you will be using to invoke zome functions on your given zome. It has a number of handy overloads making it easier and more powerful to call your zome functions and manage the returned data. This method raises the OnDataReceived event and then either the OnZomeFunctionCallBack or OnSignalCallBack event once it has received a response from the Holochain conductor.
+ ///
+ /// The id of the HoloNET request sent to the Holochain Conductor. This id is then returned in OnDataReceived, OnZomeFunctionCallBack and OnSignalCallBack events. If this id is not passed used by calling one of the alternative overloads then HoloNET will automatically generate a unique id.
+ /// The name of the zome you wish to target.
+ /// The name of the zome function you wish to call.
+ /// A basic CLR object containing the params the zome function is expecting (optional param).
+ /// This is an optional param, where the caller can pass in the type of the dynamic data object they wish the entry data returned to be mapped to. This newly created data object will then be returned in the ZomeFunctionCallBackEventArgs.Entry.EntryDataObject property.
+ /// This is an optional param, where the caller can choose whether to wait for the Holochain Conductor response before returning to the caller or to return immediately once the request has been sent to the Holochain Conductor and then raise the OnDataReceived and then the OnZomeFunctionCallBack or OnSignalsCallBack events depending on the type of request sent to the Holochain Conductor.
+ ///
+ public async Task CallZomeFunctionAsync(string id, string zome, string function, object paramsObject, Type entryDataObjectTypeReturnedFromZome = null, ConductorResponseCallBackMode zomeResultCallBackMode = ConductorResponseCallBackMode.WaitForHolochainConductorResponse)
+ {
+ return await CallZomeFunctionAsync(id, zome, function, paramsObject, true, false, entryDataObjectTypeReturnedFromZome, zomeResultCallBackMode);
+ }
+
+ ///
+ /// This is the main method you will be using to invoke zome functions on your given zome. It has a number of handy overloads making it easier and more powerful to call your zome functions and manage the returned data. This method raises the OnDataReceived event and then either the OnZomeFunctionCallBack or OnSignalCallBack event once it has received a response from the Holochain conductor.
+ ///
+ /// The name of the zome you wish to target.
+ /// The name of the zome function you wish to call.
+ /// A basic CLR object containing the params the zome function is expecting (optional param).
+ /// This is an optional param, where the caller can pass in the type of the dynamic data object they wish the entry data returned to be mapped to.
+ /// This is an optional param, where the caller can choose whether to wait for the Holochain Conductor response before returning to the caller or to return immediately once the request has been sent to the Holochain Conductor and then raise the OnDataReceived and then the OnZomeFunctionCallBack or OnSignalsCallBack events depending on the type of request sent to the Holochain Conductor.
+ ///
+ public async Task CallZomeFunctionAsync(string zome, string function, object paramsObject, dynamic entryDataObjectReturnedFromZome = null, ConductorResponseCallBackMode zomeResultCallBackMode = ConductorResponseCallBackMode.WaitForHolochainConductorResponse)
+ {
+ _currentId++;
+ return await CallZomeFunctionAsync(_currentId.ToString(), zome, function, paramsObject, entryDataObjectReturnedFromZome, zomeResultCallBackMode);
+ }
+
+ ///
+ /// This is the main method you will be using to invoke zome functions on your given zome. It has a number of handy overloads making it easier and more powerful to call your zome functions and manage the returned data. This method raises the OnDataReceived event and then either the OnZomeFunctionCallBack or OnSignalCallBack event once it has received a response from the Holochain conductor.
+ ///
+ /// The unique id you wish to assign for this call. This id is then returned in OnDataReceived, OnZomeFunctionCallBack and OnSignalCallBack events. There are overloads that omit this param, use these overloads if you wish HoloNET to auto-generate and manage the id's for you.
+ /// The name of the zome you wish to target.
+ /// The name of the zome function you wish to call.
+ /// A basic CLR object containing the params the zome function is expecting (optional param).
+ /// This is an optional param, where the caller can pass in an instance of the dynamic data object they wish the entry data returned to be mapped to. This data object will then be returned in the ZomeFunctionCallBackEventArgs.Entry.EntryDataObject property.
+ /// This is an optional param, where the caller can choose whether to wait for the Holochain Conductor response before returning to the caller or to return immediately once the request has been sent to the Holochain Conductor and then raise the OnDataReceived and then the OnZomeFunctionCallBack or OnSignalsCallBack events depending on the type of request sent to the Holochain Conductor.
+ ///
+ public async Task CallZomeFunctionAsync(string id, string zome, string function, object paramsObject, dynamic entryDataObjectReturnedFromZome = null, ConductorResponseCallBackMode zomeResultCallBackMode = ConductorResponseCallBackMode.WaitForHolochainConductorResponse)
+ {
+ return await CallZomeFunctionAsync(id, zome, function, paramsObject, true, false, entryDataObjectReturnedFromZome, zomeResultCallBackMode);
+ }
+
+ ///
+ /// This is the main method you will be using to invoke zome functions on your given zome. It has a number of handy overloads making it easier and more powerful to call your zome functions and manage the returned data. This method raises the OnDataReceived event and then either the OnZomeFunctionCallBack or OnSignalCallBack event once it has received a response from the Holochain conductor.
+ ///
+ /// The unique id you wish to assign for this call. This id is then returned in OnDataReceived, OnZomeFunctionCallBack and OnSignalCallBack events. There are overloads that omit this param, use these overloads if you wish HoloNET to auto-generate and manage the id's for you.
+ /// The name of the zome you wish to target.
+ /// The name of the zome function you wish to call.
+ /// A basic CLR object containing the params the zome function is expecting (optional param).
+ /// This is an optional param, which defaults to true. Set this to true if you wish HoloNET to give the zome and zome function that made the call in the callback/event. If this is false then only the id will be given in the callback. This uses a small internal cache to match up the id to the given zome/function. Set this to false if you wish to save a tiny amount of memory by not utilizing this cache. If it is false then the `Zome` and `ZomeFunction` params will be missing in the ZomeCallBack, you will need to manually match the `id` to the call yourself. NOTE: If HoloNETDNA.EnforceRequestToResponseIdMatchingBehaviour is set to Warn or Error then this param will be ignored and the matching will always occur.
+ /// This is an optional param, which defaults to false. Set this to true if you wish HoloNET to cache the response retrieved from holochain. Subsequent calls will return this cached data rather than calling the Holochain conductor again. Use this for static data that is not going to change for performance gains.
+ /// This is an optional param, where the caller can pass in the type of the dynamic data object they wish the entry data returned to be mapped to. This newly created data object will then be returned in the ZomeFunctionCallBackEventArgs.Entry.EntryDataObject property.
+ /// This is an optional param, where the caller can choose whether to wait for the Holochain Conductor response before returning to the caller or to return immediately once the request has been sent to the Holochain Conductor and then raise the OnDataReceived and then the OnZomeFunctionCallBack or OnSignalsCallBack events depending on the type of request sent to the Holochain Conductor.
+ ///
+ public async Task CallZomeFunctionAsync(string id, string zome, string function, object paramsObject, bool matchIdToZomeFuncInCallback = true, bool cachReturnData = false, Type entryDataObjectTypeReturnedFromZome = null, ConductorResponseCallBackMode zomeResultCallBackMode = ConductorResponseCallBackMode.WaitForHolochainConductorResponse)
+ {
+ _entryDataObjectTypeLookup[id] = entryDataObjectTypeReturnedFromZome;
+ return await CallZomeFunctionAsync(id, zome, function, null, paramsObject, matchIdToZomeFuncInCallback, cachReturnData, zomeResultCallBackMode);
+ }
+
+ ///
+ /// This is the main method you will be using to invoke zome functions on your given zome. It has a number of handy overloads making it easier and more powerful to call your zome functions and manage the returned data. This method raises the OnDataReceived event and then either the OnZomeFunctionCallBack or OnSignalCallBack event once it has received a response from the Holochain conductor.
+ ///
+ /// The unique id you wish to assign for this call. This id is then returned in OnDataReceived, OnZomeFunctionCallBack and OnSignalCallBack events. There are overloads that omit this param, use these overloads if you wish HoloNET to auto-generate and manage the id's for you.
+ /// The name of the zome you wish to target.
+ /// The name of the zome function you wish to call.
+ /// A basic CLR object containing the params the zome function is expecting (optional param).
+ /// This is an optional param, which defaults to true. Set this to true if you wish HoloNET to give the zome and zome function that made the call in the callback/event. If this is false then only the id will be given in the callback. This uses a small internal cache to match up the id to the given zome/function. Set this to false if you wish to save a tiny amount of memory by not utilizing this cache. If it is false then the `Zome` and `ZomeFunction` params will be missing in the ZomeCallBack, you will need to manually match the `id` to the call yourself. NOTE: If HoloNETDNA.EnforceRequestToResponseIdMatchingBehaviour is set to Warn or Error then this param will be ignored and the matching will always occur.
+ /// This is an optional param, which defaults to false. Set this to true if you wish HoloNET to cache the response retrieved from holochain. Subsequent calls will return this cached data rather than calling the Holochain conductor again. Use this for static data that is not going to change for performance gains.
+ /// This is an optional param, where the caller can pass in an instance of the dynamic data object they wish the entry data returned to be mapped to. This data object will then be returned in the ZomeFunctionCallBackEventArgs.Entry.EntryDataObject property.
+ /// This is an optional param, where the caller can choose whether to wait for the Holochain Conductor response before returning to the caller or to return immediately once the request has been sent to the Holochain Conductor and then raise the OnDataReceived and then the OnZomeFunctionCallBack or OnSignalsCallBack events depending on the type of request sent to the Holochain Conductor.
+ ///
+ public async Task CallZomeFunctionAsync(string id, string zome, string function, object paramsObject, bool matchIdToZomeFuncInCallback = true, bool cachReturnData = false, dynamic entryDataObjectReturnedFromZome = null, ConductorResponseCallBackMode zomeResultCallBackMode = ConductorResponseCallBackMode.WaitForHolochainConductorResponse)
+ {
+ _entryDataObjectLookup[id] = entryDataObjectReturnedFromZome;
+ return await CallZomeFunctionAsync(id, zome, function, null, paramsObject, matchIdToZomeFuncInCallback, cachReturnData, zomeResultCallBackMode);
+ }
+
+ ///
+ /// This is the main method you will be using to invoke zome functions on your given zome. It has a number of handy overloads making it easier and more powerful to call your zome functions and manage the returned data. This method raises the OnDataReceived event and then either the OnZomeFunctionCallBack or OnSignalCallBack event once it has received a response from the Holochain conductor.
+ ///
+ /// The name of the zome you wish to target.
+ /// The name of the zome function you wish to call.
+ /// A delegate to call once the zome function returns. This delegate contains the same signature as the one used for the OnZomeFunctionCallBack event. (optional param).
+ /// A basic CLR object containing the params the zome function is expecting (optional param).
+ ///
+ public async Task CallZomeFunctionAsync(string zome, string function, ZomeFunctionCallBack callback, object paramsObject)
+ {
+ _currentId++;
+ return await CallZomeFunctionAsync(_currentId.ToString(), zome, function, callback, paramsObject, true, false, ConductorResponseCallBackMode.WaitForHolochainConductorResponse);
+ }
+
+ ///
+ /// This is the main method you will be using to invoke zome functions on your given zome. It has a number of handy overloads making it easier and more powerful to call your zome functions and manage the returned data. This method raises the OnDataReceived event and then either the OnZomeFunctionCallBack or OnSignalCallBack event once it has received a response from the Holochain conductor.
+ ///
+ /// The name of the zome you wish to target.
+ /// The name of the zome function you wish to call.
+ /// A delegate to call once the zome function returns. This delegate contains the same signature as the one used for the OnZomeFunctionCallBack event. (optional param).
+ /// A basic CLR object containing the params the zome function is expecting (optional param).
+ /// This is an optional param, where the caller can choose whether to wait for the Holochain Conductor response before returning to the caller or to return immediately once the request has been sent to the Holochain Conductor and then raise the OnDataReceived and then the OnZomeFunctionCallBack or OnSignalsCallBack events depending on the type of request sent to the Holochain Conductor.
+ ///
+ public async Task CallZomeFunctionAsync(string zome, string function, ZomeFunctionCallBack callback, object paramsObject, ConductorResponseCallBackMode zomeResultCallBackMode = ConductorResponseCallBackMode.WaitForHolochainConductorResponse)
+ {
+ _currentId++;
+ return await CallZomeFunctionAsync(_currentId.ToString(), zome, function, callback, paramsObject, true, false, zomeResultCallBackMode);
+ }
+
+ ///
+ /// This is the main method you will be using to invoke zome functions on your given zome. It has a number of handy overloads making it easier and more powerful to call your zome functions and manage the returned data. This method raises the OnDataReceived event and then either the OnZomeFunctionCallBack or OnSignalCallBack event once it has received a response from the Holochain conductor.
+ ///
+ /// The name of the zome you wish to target.
+ /// The name of the zome function you wish to call.
+ /// A delegate to call once the zome function returns. This delegate contains the same signature as the one used for the OnZomeFunctionCallBack event. (optional param).
+ /// A basic CLR object containing the params the zome function is expecting (optional param).
+ /// This is an optional param, which defaults to false. Set this to true if you wish HoloNET to cache the response retrieved from holochain. Subsequent calls will return this cached data rather than calling the Holochain conductor again. Use this for static data that is not going to change for performance gains.
+ /// This is an optional param, where the caller can choose whether to wait for the Holochain Conductor response before returning to the caller or to return immediately once the request has been sent to the Holochain Conductor and then raise the OnDataReceived and then the OnZomeFunctionCallBack or OnSignalsCallBack events depending on the type of request sent to the Holochain Conductor.
+ ///
+ public async Task CallZomeFunctionAsync(string zome, string function, ZomeFunctionCallBack callback, object paramsObject, bool cachReturnData = false, ConductorResponseCallBackMode zomeResultCallBackMode = ConductorResponseCallBackMode.WaitForHolochainConductorResponse)
+ {
+ _currentId++;
+ return await CallZomeFunctionAsync(_currentId.ToString(), zome, function, callback, paramsObject, true, cachReturnData, zomeResultCallBackMode);
+ }
+
+ ///
+ /// This is the main method you will be using to invoke zome functions on your given zome. It has a number of handy overloads making it easier and more powerful to call your zome functions and manage the returned data. This method raises the OnDataReceived event and then either the OnZomeFunctionCallBack or OnSignalCallBack event once it has received a response from the Holochain conductor.
+ ///
+ /// The name of the zome you wish to target.
+ /// The name of the zome function you wish to call.
+ /// A delegate to call once the zome function returns. This delegate contains the same signature as the one used for the OnZomeFunctionCallBack event. (optional param).
+ /// A basic CLR object containing the params the zome function is expecting (optional param).
+ /// This is an optional param, where the caller can pass in the type of the dynamic data object they wish the entry data returned to be mapped to. This newly created data object will then be returned in the ZomeFunctionCallBackEventArgs.Entry.EntryDataObject property.
+ /// This is an optional param, where the caller can choose whether to wait for the Holochain Conductor response before returning to the caller or to return immediately once the request has been sent to the Holochain Conductor and then raise the OnDataReceived and then the OnZomeFunctionCallBack or OnSignalsCallBack events depending on the type of request sent to the Holochain Conductor.
+ ///
+ public async Task CallZomeFunctionAsync(string zome, string function, ZomeFunctionCallBack callback, object paramsObject, Type entryDataObjectTypeReturnedFromZome = null, ConductorResponseCallBackMode zomeResultCallBackMode = ConductorResponseCallBackMode.WaitForHolochainConductorResponse)
+ {
+ _currentId++;
+ return await CallZomeFunctionAsync(_currentId.ToString(), zome, function, callback, paramsObject, true, false, entryDataObjectTypeReturnedFromZome, zomeResultCallBackMode);
+ }
+
+ ///
+ /// This is the main method you will be using to invoke zome functions on your given zome. It has a number of handy overloads making it easier and more powerful to call your zome functions and manage the returned data. This method raises the OnDataReceived event and then either the OnZomeFunctionCallBack or OnSignalCallBack event once it has received a response from the Holochain conductor.
+ ///
+ /// The name of the zome you wish to target.
+ /// The name of the zome function you wish to call.
+ /// A delegate to call once the zome function returns. This delegate contains the same signature as the one used for the OnZomeFunctionCallBack event. (optional param).
+ /// A basic CLR object containing the params the zome function is expecting (optional param).
+ /// This is an optional param, where the caller can pass in an instance of the dynamic data object they wish the entry data returned to be mapped to. This data object will then be returned in the ZomeFunctionCallBackEventArgs.Entry.EntryDataObject property.
+ /// This is an optional param, where the caller can choose whether to wait for the Holochain Conductor response before returning to the caller or to return immediately once the request has been sent to the Holochain Conductor and then raise the OnDataReceived and then the OnZomeFunctionCallBack or OnSignalsCallBack events depending on the type of request sent to the Holochain Conductor.
+ ///
+ public async Task CallZomeFunctionAsync(string zome, string function, ZomeFunctionCallBack callback, object paramsObject, dynamic entryDataObjectReturnedFromZome = null, ConductorResponseCallBackMode zomeResultCallBackMode = ConductorResponseCallBackMode.WaitForHolochainConductorResponse)
+ {
+ _currentId++;
+ return await CallZomeFunctionAsync(_currentId.ToString(), zome, function, callback, paramsObject, true, false, entryDataObjectReturnedFromZome, zomeResultCallBackMode);
+ }
+
+ ///
+ /// This is the main method you will be using to invoke zome functions on your given zome. It has a number of handy overloads making it easier and more powerful to call your zome functions and manage the returned data. This method raises the OnDataReceived event and then either the OnZomeFunctionCallBack or OnSignalCallBack event once it has received a response from the Holochain conductor.
+ ///
+ /// The name of the zome you wish to target.
+ /// The name of the zome function you wish to call.
+ /// A delegate to call once the zome function returns. This delegate contains the same signature as the one used for the OnZomeFunctionCallBack event. (optional param).
+ /// A basic CLR object containing the params the zome function is expecting (optional param).
+ /// This is an optional param, which defaults to false. Set this to true if you wish HoloNET to cache the response retrieved from holochain. Subsequent calls will return this cached data rather than calling the Holochain conductor again. Use this for static data that is not going to change for performance gains.
+ /// This is an optional param, where the caller can pass in the type of the dynamic data object they wish the entry data returned to be mapped to. This newly created data object will then be returned in the ZomeFunctionCallBackEventArgs.Entry.EntryDataObject property.
+ /// This is an optional param, where the caller can choose whether to wait for the Holochain Conductor response before returning to the caller or to return immediately once the request has been sent to the Holochain Conductor and then raise the OnDataReceived and then the OnZomeFunctionCallBack or OnSignalsCallBack events depending on the type of request sent to the Holochain Conductor.
+ ///
+ public async Task CallZomeFunctionAsync(string zome, string function, ZomeFunctionCallBack callback, object paramsObject, bool cachReturnData = false, Type entryDataObjectTypeReturnedFromZome = null, ConductorResponseCallBackMode zomeResultCallBackMode = ConductorResponseCallBackMode.WaitForHolochainConductorResponse)
+ {
+ _currentId++;
+ return await CallZomeFunctionAsync(_currentId.ToString(), zome, function, callback, paramsObject, true, cachReturnData, entryDataObjectTypeReturnedFromZome, zomeResultCallBackMode);
+ }
+
+ ///
+ /// This is the main method you will be using to invoke zome functions on your given zome. It has a number of handy overloads making it easier and more powerful to call your zome functions and manage the returned data. This method raises the OnDataReceived event and then either the OnZomeFunctionCallBack or OnSignalCallBack event once it has received a response from the Holochain conductor.
+ ///
+ /// The unique id you wish to assign for this call. This id is then returned in OnDataReceived, OnZomeFunctionCallBack and OnSignalCallBack events. There are overloads that omit this param, use these overloads if you wish HoloNET to auto-generate and manage the id's for you.
+ /// The name of the zome you wish to target.
+ /// The name of the zome function you wish to call.
+ /// A delegate to call once the zome function returns. This delegate contains the same signature as the one used for the OnZomeFunctionCallBack event. (optional param).
+ /// A basic CLR object containing the params the zome function is expecting (optional param).
+ /// This is an optional param, which defaults to true. Set this to true if you wish HoloNET to give the zome and zome function that made the call in the callback/event. If this is false then only the id will be given in the callback. This uses a small internal cache to match up the id to the given zome/function. Set this to false if you wish to save a tiny amount of memory by not utilizing this cache. If it is false then the `Zome` and `ZomeFunction` params will be missing in the ZomeCallBack, you will need to manually match the `id` to the call yourself. NOTE: If HoloNETDNA.EnforceRequestToResponseIdMatchingBehaviour is set to Warn or Error then this param will be ignored and the matching will always occur.
+ /// This is an optional param, which defaults to false. Set this to true if you wish HoloNET to cache the response retrieved from holochain. Subsequent calls will return this cached data rather than calling the Holochain conductor again. Use this for static data that is not going to change for performance gains.
+ /// This is an optional param, where the caller can pass in an instance of the dynamic data object they wish the entry data returned to be mapped to. This data object will then be returned in the ZomeFunctionCallBackEventArgs.Entry.EntryDataObject property.
+ /// This is an optional param, where the caller can choose whether to wait for the Holochain Conductor response before returning to the caller or to return immediately once the request has been sent to the Holochain Conductor and then raise the OnDataReceived and then the OnZomeFunctionCallBack or OnSignalsCallBack events depending on the type of request sent to the Holochain Conductor.
+ ///
+ public async Task CallZomeFunctionAsync(string id, string zome, string function, ZomeFunctionCallBack callback, object paramsObject, bool matchIdToZomeFuncInCallback = true, bool cachReturnData = false, dynamic entryDataObjectReturnedFromZome = null, ConductorResponseCallBackMode zomeResultCallBackMode = ConductorResponseCallBackMode.WaitForHolochainConductorResponse)
+ {
+ _entryDataObjectLookup[id] = entryDataObjectReturnedFromZome;
+ return await CallZomeFunctionAsync(id, zome, function, callback, paramsObject, matchIdToZomeFuncInCallback, cachReturnData, zomeResultCallBackMode);
+ }
+
+ ///
+ /// This is the main method you will be using to invoke zome functions on your given zome. It has a number of handy overloads making it easier and more powerful to call your zome functions and manage the returned data. This method raises the OnDataReceived event and then either the OnZomeFunctionCallBack or OnSignalCallBack event once it has received a response from the Holochain conductor.
+ ///
+ /// The unique id you wish to assign for this call. This id is then returned in OnDataReceived, OnZomeFunctionCallBack and OnSignalCallBack events. There are overloads that omit this param, use these overloads if you wish HoloNET to auto-generate and manage the id's for you.
+ /// The name of the zome you wish to target.
+ /// The name of the zome function you wish to call.
+ /// A delegate to call once the zome function returns. This delegate contains the same signature as the one used for the OnZomeFunctionCallBack event. (optional param).
+ /// A basic CLR object containing the params the zome function is expecting (optional param).
+ /// This is an optional param, which defaults to true. Set this to true if you wish HoloNET to give the zome and zome function that made the call in the callback/event. If this is false then only the id will be given in the callback. This uses a small internal cache to match up the id to the given zome/function. Set this to false if you wish to save a tiny amount of memory by not utilizing this cache. If it is false then the `Zome` and `ZomeFunction` params will be missing in the ZomeCallBack, you will need to manually match the `id` to the call yourself. NOTE: If HoloNETDNA.EnforceRequestToResponseIdMatchingBehaviour is set to Warn or Error then this param will be ignored and the matching will always occur.
+ /// This is an optional param, which defaults to false. Set this to true if you wish HoloNET to cache the response retrieved from holochain. Subsequent calls will return this cached data rather than calling the Holochain conductor again. Use this for static data that is not going to change for performance gains.
+ /// This is an optional param, where the caller can pass in the type of the dynamic data object they wish the entry data returned to be mapped to. This newly created data object will then be returned in the ZomeFunctionCallBackEventArgs.Entry.EntryDataObject property.
+ /// This is an optional param, where the caller can choose whether to wait for the Holochain Conductor response before returning to the caller or to return immediately once the request has been sent to the Holochain Conductor and then raise the OnDataReceived and then the OnZomeFunctionCallBack or OnSignalsCallBack events depending on the type of request sent to the Holochain Conductor.
+ ///
+ public async Task CallZomeFunctionAsync(string id, string zome, string function, ZomeFunctionCallBack callback, object paramsObject, bool matchIdToZomeFuncInCallback = true, bool cachReturnData = false, Type entryDataObjectTypeReturnedFromZome = null, ConductorResponseCallBackMode zomeResultCallBackMode = ConductorResponseCallBackMode.WaitForHolochainConductorResponse)
+ {
+ _entryDataObjectTypeLookup[id] = entryDataObjectTypeReturnedFromZome;
+ return await CallZomeFunctionAsync(id, zome, function, callback, paramsObject, matchIdToZomeFuncInCallback, cachReturnData, zomeResultCallBackMode);
+ }
+
+ ///
+ /// This is the main method you will be using to invoke zome functions on your given zome. It has a number of handy overloads making it easier and more powerful to call your zome functions and manage the returned data. This method raises the OnDataReceived event and then either the OnZomeFunctionCallBack or OnSignalCallBack event once it has received a response from the Holochain conductor.
+ ///
+ /// The unique id you wish to assign for this call. This id is then returned in OnDataReceived, OnZomeFunctionCallBack and OnSignalCallBack events. There are overloads that omit this param, use these overloads if you wish HoloNET to auto-generate and manage the id's for you.
+ /// The name of the zome you wish to target.
+ /// The name of the zome function you wish to call.
+ /// A delegate to call once the zome function returns. This delegate contains the same signature as the one used for the OnZomeFunctionCallBack event. (optional param).
+ /// A basic CLR object containing the params the zome function is expecting (optional param).
+ /// This is an optional param, which defaults to true. Set this to true if you wish HoloNET to give the zome and zome function that made the call in the callback/event. If this is false then only the id will be given in the callback. This uses a small internal cache to match up the id to the given zome/function. Set this to false if you wish to save a tiny amount of memory by not utilizing this cache. If it is false then the `Zome` and `ZomeFunction` params will be missing in the ZomeCallBack, you will need to manually match the `id` to the call yourself. NOTE: If HoloNETDNA.EnforceRequestToResponseIdMatchingBehaviour is set to Warn or Error then this param will be ignored and the matching will always occur.
+ /// This is an optional param, which defaults to false. Set this to true if you wish HoloNET to cache the response retrieved from holochain. Subsequent calls will return this cached data rather than calling the Holochain conductor again. Use this for static data that is not going to change for performance gains.
+ /// This is an optional param, where the caller can choose whether to wait for the Holochain Conductor response before returning to the caller or to return immediately once the request has been sent to the Holochain Conductor and then raise the OnDataReceived and then the OnZomeFunctionCallBack or OnSignalsCallBack events depending on the type of request sent to the Holochain Conductor.
+ ///
+ public async Task CallZomeFunctionAsync(string id, string zome, string function, ZomeFunctionCallBack callback, object paramsObject, bool matchIdToZomeFuncInCallback = true, bool cachReturnData = false, ConductorResponseCallBackMode zomeResultCallBackMode = ConductorResponseCallBackMode.WaitForHolochainConductorResponse)
+ {
+ try
+ {
+ _taskCompletionZomeCallBack[id] = new TaskCompletionSource();
+
+ //if (WebSocket.State == WebSocketState.Closed || WebSocket.State == WebSocketState.None)
+ if (WebSocket.State != WebSocketState.Open && WebSocket.State != WebSocketState.Connecting)
+ await ConnectAsync();
+
+ if (!IsReadyForZomesCalls)
+ {
+ if (zomeResultCallBackMode == ConductorResponseCallBackMode.WaitForHolochainConductorResponse)
+ await WaitTillReadyForZomeCallsAsync();
+ else
+ return new ZomeFunctionCallBackEventArgs() { EndPoint = EndPoint, Id = id, Zome = zome, ZomeFunction = function, IsError = true, Message = "HoloNET is not ready to make zome calls yet, please wait till the ReadyForZomeCalls event is fired before attempting to make a zome call." };
+ }
+
+ if (string.IsNullOrEmpty(HoloNETDNA.DnaHash))
+ return new ZomeFunctionCallBackEventArgs() { EndPoint = EndPoint, Id = id, Zome = zome, ZomeFunction = function, IsError = true, Message = "The DnaHash cannot be empty, please either set manually in the HoloNETDNA.DnaHash property or wait till the ReadyForZomeCalls event is fired before attempting to make a zome call." };
+ //throw new InvalidOperationException("The DnaHash cannot be empty, please either set manually in the HoloNETDNA.DnaHash property or wait till the ReadyForZomeCalls event is fired before attempting to make a zome call.");
+
+ if (string.IsNullOrEmpty(HoloNETDNA.AgentPubKey))
+ return new ZomeFunctionCallBackEventArgs() { EndPoint = EndPoint, Id = id, Zome = zome, ZomeFunction = function, IsError = true, Message = "The AgentPubKey cannot be empty, please either set manually in the HoloNETDNA.DnaHash property or wait till the ReadyForZomeCalls event is fired before attempting to make a zome call." };
+ //throw new InvalidOperationException("The AgentPubKey cannot be empty, please either set manually in the HoloNETDNA.AgentPubKey property or wait till the ReadyForZomeCalls event is fired before attempting to make a zome call.");
+
+ Logger.Log($"Calling Zome Function {function} on Zome {zome} with Id {id} On Holochain Conductor...", LogType.Info, true);
+
+ _cacheZomeReturnDataLookup[id] = cachReturnData;
+
+ if (cachReturnData)
+ {
+ if (_zomeReturnDataLookup.ContainsKey(id))
+ {
+ Logger.Log("Caching Enabled so returning data from cache...", LogType.Info);
+ Logger.Log(string.Concat("Id: ", _zomeReturnDataLookup[id].Id, ", Zome: ", _zomeReturnDataLookup[id].Zome, ", Zome Function: ", _zomeReturnDataLookup[id].ZomeFunction, ", Raw Zome Return Data: ", _zomeReturnDataLookup[id].RawZomeReturnData, ", Zome Return Data: ", _zomeReturnDataLookup[id].ZomeReturnData, ", JSON Raw Data: ", _zomeReturnDataLookup[id].RawJSONData), LogType.Info);
+ //Logger.Log(string.Concat("Id: ", _zomeReturnDataLookup[id].Id, ", Zome: ", _zomeReturnDataLookup[id].Zome, ", Zome Function: ", _zomeReturnDataLookup[id].ZomeFunction, ", Is Zome Call Successful: ", _zomeReturnDataLookup[id].IsCallSuccessful ? "True" : "False", ", Raw Zome Return Data: ", _zomeReturnDataLookup[id].RawZomeReturnData, ", Zome Return Data: ", _zomeReturnDataLookup[id].ZomeReturnData, ", JSON Raw Data: ", _zomeReturnDataLookup[id].RawJSONData), LogType.Info);
+
+ if (callback != null)
+ callback.DynamicInvoke(this, _zomeReturnDataLookup[id]);
+
+ OnZomeFunctionCallBack?.Invoke(this, _zomeReturnDataLookup[id]);
+ _taskCompletionZomeCallBack[id].SetResult(_zomeReturnDataLookup[id]);
+
+ Task returnValue = _taskCompletionZomeCallBack[id].Task;
+ _taskCompletionZomeCallBack.Remove(id);
+
+ return await returnValue;
+ }
+ }
+
+ if (matchIdToZomeFuncInCallback || HoloNETDNA.EnforceRequestToResponseIdMatchingBehaviour != EnforceRequestToResponseIdMatchingBehaviour.Ignore)
+ {
+ _zomeLookup[id] = zome;
+ _funcLookup[id] = function;
+ }
+
+ if (callback != null)
+ _callbackLookup[id] = callback;
+
+ //_responseMustHaveMatchingRequestLookup[id] = responseMustHaveMatchingRequest;
+
+ try
+ {
+ if (paramsObject != null && paramsObject.GetType() == typeof(string))
+ {
+ byte[] holoHash = null;
+ holoHash = ConvertHoloHashToBytes(paramsObject.ToString());
+
+ if (holoHash != null)
+ paramsObject = holoHash;
+ }
+ }
+ catch (Exception ex)
+ {
+
+ }
+
+ string cellId = $"{HoloNETDNA.AgentPubKey}:{HoloNETDNA.DnaHash}";
+
+ if (_signingCredentialsForCell.ContainsKey(cellId) && _signingCredentialsForCell[cellId] != null)
+ {
+ ZomeCallUnsigned payload = new ZomeCallUnsigned()
+ {
+ cap_secret = _signingCredentialsForCell[cellId].CapSecret,
+ cell_id_agent_pub_key = ConvertHoloHashToBytes(HoloNETDNA.AgentPubKey),
+ cell_id_dna_hash = ConvertHoloHashToBytes(HoloNETDNA.DnaHash),
+ fn_name = function,
+ zome_name = zome,
+ payload = MessagePackSerializer.Serialize(paramsObject),
+ provenance = _signingCredentialsForCell[cellId].SigningKey,
+ nonce = SodiumCore.GetRandomBytes(32),
+ //expires_at = DateTime.Now.AddMinutes(5).Ticks / 10
+ expires_at = (DateTimeOffset.Now.ToUnixTimeMilliseconds() + 5 * 60 * 1000) * 1000
+ };
+
+ byte[] hash = new byte[32];
+ try
+ {
+ // Call into the `holochain_zome_types` crate to get a blake2b hash of the zomeCall
+ HolochainSerialisationWrapper.call_get_data_to_sign(hash, payload);
+ }
+ catch (Exception e)
+ {
+ Console.WriteLine("Failed to get data to sign: " + e.ToString());
+ }
+
+ //byte[] hash = Blake2b.ComputeHash(MessagePackSerializer.Serialize(payload));
+ var sig = Sodium.PublicKeyAuth.SignDetached(hash, _signingCredentialsForCell[cellId].KeyPair.PrivateKey);
+
+ ZomeCallSigned signedPayload = new ZomeCallSigned()
+ {
+ cap_secret = payload.cap_secret,
+ //cell_id = payload.cell_id,
+ cell_id = [payload.cell_id_dna_hash, payload.cell_id_agent_pub_key],
+ fn_name = payload.fn_name,
+ zome_name = payload.zome_name,
+ payload = payload.payload,
+ provenance = payload.provenance,
+ nonce = payload.nonce,
+ expires_at = payload.expires_at,
+ signature = sig[0..64]
+ };
+
+ HoloNETData holoNETData = new HoloNETData()
+ {
+ type = "call_zome",
+ data = signedPayload
+ };
+
+ await SendHoloNETRequestAsync(holoNETData, HoloNETRequestType.ZomeCall, id);
+
+ if (zomeResultCallBackMode == ConductorResponseCallBackMode.WaitForHolochainConductorResponse)
+ {
+ Task returnValue = _taskCompletionZomeCallBack[id].Task;
+ return await returnValue;
+ }
+ else
+ return new ZomeFunctionCallBackEventArgs() { EndPoint = EndPoint, Id = id, Zome = zome, ZomeFunction = function, Message = "ZomeResultCallBackMode is set to UseCallBackEvents so please wait for OnZomeFunctionCallBack event for zome result." };
+ }
+ else
+ {
+ string msg = $"Error occurred in HoloNETClient.CallZomeFunctionAsync method: Cannot sign zome call when no signing credentials have been authorized for the cell (AgentPubKey: {HoloNETDNA.AgentPubKey}, DnaHash: {HoloNETDNA.DnaHash}).";
+ HandleError(msg, null);
+ return new ZomeFunctionCallBackEventArgs() { EndPoint = EndPoint, Id = id, Zome = zome, ZomeFunction = function, Message = msg, IsError = true };
+ }
+ }
+ catch (Exception ex)
+ {
+ HandleError("Error occurred in HoloNETClient.CallZomeFunctionAsync method.", ex);
+ return new ZomeFunctionCallBackEventArgs() { EndPoint = EndPoint, Id = id, Zome = zome, ZomeFunction = function, IsError = true, Message = $"Error occurred in HoloNETClient.CallZomeFunctionAsync method. Details: {ex}", Exception = ex };
+ }
+ }
+
+ ///
+ /// This is the main method you will be using to invoke zome functions on your given zome. It has a number of handy overloads making it easier and more powerful to call your zome functions and manage the returned data. This method raises the OnDataReceived event and then either the OnZomeFunctionCallBack or OnSignalCallBack event once it has received a response from the Holochain conductor.
+ ///
+ /// The name of the zome you wish to target.
+ /// The name of the zome function you wish to call.
+ /// A basic CLR object containing the params the zome function is expecting.
+ ///
+ public ZomeFunctionCallBackEventArgs CallZomeFunction(string zome, string function, object paramsObject)
+ {
+ _currentId++;
+ return CallZomeFunction(_currentId.ToString(), zome, function, null, paramsObject, true, false, ConductorResponseCallBackMode.WaitForHolochainConductorResponse);
+ }
+
+ ///
+ /// This is the main method you will be using to invoke zome functions on your given zome. It has a number of handy overloads making it easier and more powerful to call your zome functions and manage the returned data. This method raises the OnDataReceived event and then either the OnZomeFunctionCallBack or OnSignalCallBack event once it has received a response from the Holochain conductor.
+ ///
+ /// The name of the zome you wish to target.
+ /// The name of the zome function you wish to call.
+ /// A basic CLR object containing the params the zome function is expecting (optional param).
+ /// This is an optional param, where the caller can choose whether to wait for the Holochain Conductor response before returning to the caller or to return immediately once the request has been sent to the Holochain Conductor and then raise the OnDataReceived and then the OnZomeFunctionCallBack or OnSignalsCallBack events depending on the type of request sent to the Holochain Conductor.
+ ///
+ public ZomeFunctionCallBackEventArgs CallZomeFunction(string zome, string function, object paramsObject, ConductorResponseCallBackMode zomeResultCallBackMode = ConductorResponseCallBackMode.WaitForHolochainConductorResponse)
+ {
+ _currentId++;
+ return CallZomeFunction(_currentId.ToString(), zome, function, null, paramsObject, true, false, zomeResultCallBackMode);
+ }
+
+ ///
+ /// This is the main method you will be using to invoke zome functions on your given zome. It has a number of handy overloads making it easier and more powerful to call your zome functions and manage the returned data. This method raises the OnDataReceived event and then either the OnZomeFunctionCallBack or OnSignalCallBack event once it has received a response from the Holochain conductor.
+ ///
+ /// The name of the zome you wish to target.
+ /// The name of the zome function you wish to call.
+ /// A basic CLR object containing the params the zome function is expecting (optional param).
+ /// This is an optional param, which defaults to false. Set this to true if you wish HoloNET to cache the response retrieved from holochain. Subsequent calls will return this cached data rather than calling the Holochain conductor again. Use this for static data that is not going to change for performance gains.
+ /// This is an optional param, where the caller can choose whether to wait for the Holochain Conductor response before returning to the caller or to return immediately once the request has been sent to the Holochain Conductor and then raise the OnDataReceived and then the OnZomeFunctionCallBack or OnSignalsCallBack events depending on the type of request sent to the Holochain Conductor.
+ ///
+ public ZomeFunctionCallBackEventArgs CallZomeFunction(string zome, string function, object paramsObject, bool cachReturnData = false, ConductorResponseCallBackMode zomeResultCallBackMode = ConductorResponseCallBackMode.WaitForHolochainConductorResponse)
+ {
+ _currentId++;
+ return CallZomeFunction(_currentId.ToString(), zome, function, null, paramsObject, true, cachReturnData, zomeResultCallBackMode);
+ }
+
+ ///
+ /// This is the main method you will be using to invoke zome functions on your given zome. It has a number of handy overloads making it easier and more powerful to call your zome functions and manage the returned data. This method raises the OnDataReceived event and then either the OnZomeFunctionCallBack or OnSignalCallBack event once it has received a response from the Holochain conductor.
+ ///
+ /// The name of the zome you wish to target.
+ /// The name of the zome function you wish to call.
+ /// A basic CLR object containing the params the zome function is expecting (optional param).
+ /// This is an optional param, where the caller can pass in the type of the dynamic data object they wish the entry data returned to be mapped to. This newly created data object will then be returned in the ZomeFunctionCallBackEventArgs.Entry.EntryDataObject property.
+ /// This is an optional param, where the caller can choose whether to wait for the Holochain Conductor response before returning to the caller or to return immediately once the request has been sent to the Holochain Conductor and then raise the OnDataReceived and then the OnZomeFunctionCallBack or OnSignalsCallBack events depending on the type of request sent to the Holochain Conductor.
+ ///
+ public ZomeFunctionCallBackEventArgs CallZomeFunction(string zome, string function, object paramsObject, Type entryDataObjectTypeReturnedFromZome = null, ConductorResponseCallBackMode zomeResultCallBackMode = ConductorResponseCallBackMode.WaitForHolochainConductorResponse)
+ {
+ _currentId++;
+ return CallZomeFunction(_currentId.ToString(), zome, function, paramsObject, entryDataObjectTypeReturnedFromZome, zomeResultCallBackMode);
+ }
+
+ ///
+ /// This is the main method you will be using to invoke zome functions on your given zome. It has a number of handy overloads making it easier and more powerful to call your zome functions and manage the returned data. This method raises the OnDataReceived event and then either the OnZomeFunctionCallBack or OnSignalCallBack event once it has received a response from the Holochain conductor.
+ ///
+ /// The id of the HoloNET request sent to the Holochain Conductor. This id is then returned in OnDataReceived, OnZomeFunctionCallBack and OnSignalCallBack events. If this id is not passed used by calling one of the alternative overloads then HoloNET will automatically generate a unique id.
+ /// The name of the zome you wish to target.
+ /// The name of the zome function you wish to call.
+ /// A basic CLR object containing the params the zome function is expecting (optional param).
+ /// This is an optional param, where the caller can pass in the type of the dynamic data object they wish the entry data returned to be mapped to. This newly created data object will then be returned in the ZomeFunctionCallBackEventArgs.Entry.EntryDataObject property.
+ /// This is an optional param, where the caller can choose whether to wait for the Holochain Conductor response before returning to the caller or to return immediately once the request has been sent to the Holochain Conductor and then raise the OnDataReceived and then the OnZomeFunctionCallBack or OnSignalsCallBack events depending on the type of request sent to the Holochain Conductor.
+ ///
+ public ZomeFunctionCallBackEventArgs CallZomeFunction(string id, string zome, string function, object paramsObject, Type entryDataObjectTypeReturnedFromZome = null, ConductorResponseCallBackMode zomeResultCallBackMode = ConductorResponseCallBackMode.WaitForHolochainConductorResponse)
+ {
+ return CallZomeFunction(id, zome, function, paramsObject, true, false, entryDataObjectTypeReturnedFromZome, zomeResultCallBackMode);
+ }
+
+ ///
+ /// This is the main method you will be using to invoke zome functions on your given zome. It has a number of handy overloads making it easier and more powerful to call your zome functions and manage the returned data. This method raises the OnDataReceived event and then either the OnZomeFunctionCallBack or OnSignalCallBack event once it has received a response from the Holochain conductor.
+ ///
+ /// The name of the zome you wish to target.
+ /// The name of the zome function you wish to call.
+ /// A basic CLR object containing the params the zome function is expecting (optional param).
+ /// This is an optional param, where the caller can pass in the type of the dynamic data object they wish the entry data returned to be mapped to.
+ /// This is an optional param, where the caller can choose whether to wait for the Holochain Conductor response before returning to the caller or to return immediately once the request has been sent to the Holochain Conductor and then raise the OnDataReceived and then the OnZomeFunctionCallBack or OnSignalsCallBack events depending on the type of request sent to the Holochain Conductor.
+ ///
+ public ZomeFunctionCallBackEventArgs CallZomeFunction(string zome, string function, object paramsObject, dynamic entryDataObjectReturnedFromZome = null, ConductorResponseCallBackMode zomeResultCallBackMode = ConductorResponseCallBackMode.WaitForHolochainConductorResponse)
+ {
+ _currentId++;
+ return CallZomeFunctionAsync(_currentId.ToString(), zome, function, paramsObject, entryDataObjectReturnedFromZome, zomeResultCallBackMode);
+ }
+
+ ///
+ /// This is the main method you will be using to invoke zome functions on your given zome. It has a number of handy overloads making it easier and more powerful to call your zome functions and manage the returned data. This method raises the OnDataReceived event and then either the OnZomeFunctionCallBack or OnSignalCallBack event once it has received a response from the Holochain conductor.
+ ///
+ /// The unique id you wish to assign for this call. This id is then returned in OnDataReceived, OnZomeFunctionCallBack and OnSignalCallBack events. There are overloads that omit this param, use these overloads if you wish HoloNET to auto-generate and manage the id's for you.
+ /// The name of the zome you wish to target.
+ /// The name of the zome function you wish to call.
+ /// A basic CLR object containing the params the zome function is expecting (optional param).
+ /// This is an optional param, where the caller can pass in an instance of the dynamic data object they wish the entry data returned to be mapped to. This data object will then be returned in the ZomeFunctionCallBackEventArgs.Entry.EntryDataObject property.
+ /// This is an optional param, where the caller can choose whether to wait for the Holochain Conductor response before returning to the caller or to return immediately once the request has been sent to the Holochain Conductor and then raise the OnDataReceived and then the OnZomeFunctionCallBack or OnSignalsCallBack events depending on the type of request sent to the Holochain Conductor.
+ ///
+ public ZomeFunctionCallBackEventArgs CallZomeFunction(string id, string zome, string function, object paramsObject, dynamic entryDataObjectReturnedFromZome = null, ConductorResponseCallBackMode zomeResultCallBackMode = ConductorResponseCallBackMode.WaitForHolochainConductorResponse)
+ {
+ return CallZomeFunction(id, zome, function, paramsObject, true, false, entryDataObjectReturnedFromZome, zomeResultCallBackMode);
+ }
+
+ ///
+ /// This is the main method you will be using to invoke zome functions on your given zome. It has a number of handy overloads making it easier and more powerful to call your zome functions and manage the returned data. This method raises the OnDataReceived event and then either the OnZomeFunctionCallBack or OnSignalCallBack event once it has received a response from the Holochain conductor.
+ ///
+ /// The unique id you wish to assign for this call. This id is then returned in OnDataReceived, OnZomeFunctionCallBack and OnSignalCallBack events. There are overloads that omit this param, use these overloads if you wish HoloNET to auto-generate and manage the id's for you.
+ /// The name of the zome you wish to target.
+ /// The name of the zome function you wish to call.
+ /// A basic CLR object containing the params the zome function is expecting (optional param).
+ /// This is an optional param, which defaults to true. Set this to true if you wish HoloNET to give the zome and zome function that made the call in the callback/event. If this is false then only the id will be given in the callback. This uses a small internal cache to match up the id to the given zome/function. Set this to false if you wish to save a tiny amount of memory by not utilizing this cache. If it is false then the `Zome` and `ZomeFunction` params will be missing in the ZomeCallBack, you will need to manually match the `id` to the call yourself. NOTE: If HoloNETDNA.EnforceRequestToResponseIdMatchingBehaviour is set to Warn or Error then this param will be ignored and the matching will always occur.
+ /// This is an optional param, which defaults to false. Set this to true if you wish HoloNET to cache the response retrieved from holochain. Subsequent calls will return this cached data rather than calling the Holochain conductor again. Use this for static data that is not going to change for performance gains.
+ /// This is an optional param, where the caller can pass in the type of the dynamic data object they wish the entry data returned to be mapped to. This newly created data object will then be returned in the ZomeFunctionCallBackEventArgs.Entry.EntryDataObject property.
+ /// This is an optional param, where the caller can choose whether to wait for the Holochain Conductor response before returning to the caller or to return immediately once the request has been sent to the Holochain Conductor and then raise the OnDataReceived and then the OnZomeFunctionCallBack or OnSignalsCallBack events depending on the type of request sent to the Holochain Conductor.
+ ///
+ public ZomeFunctionCallBackEventArgs CallZomeFunction(string id, string zome, string function, object paramsObject, bool matchIdToZomeFuncInCallback = true, bool cachReturnData = false, Type entryDataObjectTypeReturnedFromZome = null, ConductorResponseCallBackMode zomeResultCallBackMode = ConductorResponseCallBackMode.WaitForHolochainConductorResponse)
+ {
+ _entryDataObjectTypeLookup[id] = entryDataObjectTypeReturnedFromZome;
+ return CallZomeFunction(id, zome, function, null, paramsObject, matchIdToZomeFuncInCallback, cachReturnData, zomeResultCallBackMode);
+ }
+
+ ///
+ /// This is the main method you will be using to invoke zome functions on your given zome. It has a number of handy overloads making it easier and more powerful to call your zome functions and manage the returned data. This method raises the OnDataReceived event and then either the OnZomeFunctionCallBack or OnSignalCallBack event once it has received a response from the Holochain conductor.
+ ///
+ /// The unique id you wish to assign for this call. This id is then returned in OnDataReceived, OnZomeFunctionCallBack and OnSignalCallBack events. There are overloads that omit this param, use these overloads if you wish HoloNET to auto-generate and manage the id's for you.
+ /// The name of the zome you wish to target.
+ /// The name of the zome function you wish to call.
+ /// A basic CLR object containing the params the zome function is expecting (optional param).
+ /// This is an optional param, which defaults to true. Set this to true if you wish HoloNET to give the zome and zome function that made the call in the callback/event. If this is false then only the id will be given in the callback. This uses a small internal cache to match up the id to the given zome/function. Set this to false if you wish to save a tiny amount of memory by not utilizing this cache. If it is false then the `Zome` and `ZomeFunction` params will be missing in the ZomeCallBack, you will need to manually match the `id` to the call yourself. NOTE: If HoloNETDNA.EnforceRequestToResponseIdMatchingBehaviour is set to Warn or Error then this param will be ignored and the matching will always occur.
+ /// This is an optional param, which defaults to false. Set this to true if you wish HoloNET to cache the response retrieved from holochain. Subsequent calls will return this cached data rather than calling the Holochain conductor again. Use this for static data that is not going to change for performance gains.
+ /// This is an optional param, where the caller can pass in an instance of the dynamic data object they wish the entry data returned to be mapped to. This data object will then be returned in the ZomeFunctionCallBackEventArgs.Entry.EntryDataObject property.
+ ///
+ public ZomeFunctionCallBackEventArgs CallZomeFunction(string id, string zome, string function, object paramsObject, bool matchIdToZomeFuncInCallback = true, bool cachReturnData = false, dynamic entryDataObjectReturnedFromZome = null)
+ {
+ _entryDataObjectLookup[id] = entryDataObjectReturnedFromZome;
+ return CallZomeFunction(id, zome, function, null, paramsObject, matchIdToZomeFuncInCallback, cachReturnData, ConductorResponseCallBackMode.UseCallBackEvents);
+ }
+
+ ///
+ /// This is the main method you will be using to invoke zome functions on your given zome. It has a number of handy overloads making it easier and more powerful to call your zome functions and manage the returned data. This method raises the OnDataReceived event and then either the OnZomeFunctionCallBack or OnSignalCallBack event once it has received a response from the Holochain conductor.
+ ///
+ /// The name of the zome you wish to target.
+ /// The name of the zome function you wish to call.
+ /// A delegate to call once the zome function returns. This delegate contains the same signature as the one used for the OnZomeFunctionCallBack event. (optional param).
+ /// A basic CLR object containing the params the zome function is expecting (optional param).
+ ///
+ public ZomeFunctionCallBackEventArgs CallZomeFunction(string zome, string function, ZomeFunctionCallBack callback, object paramsObject)
+ {
+ _currentId++;
+ return CallZomeFunction(_currentId.ToString(), zome, function, callback, paramsObject, true, false, ConductorResponseCallBackMode.WaitForHolochainConductorResponse);
+ }
+
+ ///
+ /// This is the main method you will be using to invoke zome functions on your given zome. It has a number of handy overloads making it easier and more powerful to call your zome functions and manage the returned data. This method raises the OnDataReceived event and then either the OnZomeFunctionCallBack or OnSignalCallBack event once it has received a response from the Holochain conductor.
+ ///
+ /// The name of the zome you wish to target.
+ /// The name of the zome function you wish to call.
+ /// A delegate to call once the zome function returns. This delegate contains the same signature as the one used for the OnZomeFunctionCallBack event. (optional param).
+ /// A basic CLR object containing the params the zome function is expecting (optional param).
+ /// This is an optional param, which defaults to false. Set this to true if you wish HoloNET to cache the response retrieved from holochain. Subsequent calls will return this cached data rather than calling the Holochain conductor again. Use this for static data that is not going to change for performance gains.
+ ///
+ public ZomeFunctionCallBackEventArgs CallZomeFunction(string zome, string function, ZomeFunctionCallBack callback, object paramsObject, bool cachReturnData = false)
+ {
+ _currentId++;
+ return CallZomeFunction(_currentId.ToString(), zome, function, callback, paramsObject, true, cachReturnData, ConductorResponseCallBackMode.UseCallBackEvents);
+ }
+
+ ///
+ /// This is the main method you will be using to invoke zome functions on your given zome. It has a number of handy overloads making it easier and more powerful to call your zome functions and manage the returned data. This method raises the OnDataReceived event and then either the OnZomeFunctionCallBack or OnSignalCallBack event once it has received a response from the Holochain conductor.
+ ///
+ /// The name of the zome you wish to target.
+ /// The name of the zome function you wish to call.
+ /// A delegate to call once the zome function returns. This delegate contains the same signature as the one used for the OnZomeFunctionCallBack event. (optional param).
+ /// A basic CLR object containing the params the zome function is expecting (optional param).
+ /// This is an optional param, where the caller can pass in an instance of the dynamic data object they wish the entry data returned to be mapped to. This data object will then be returned in the ZomeFunctionCallBackEventArgs.Entry.EntryDataObject property.
+ ///
+ public ZomeFunctionCallBackEventArgs CallZomeFunction(string zome, string function, ZomeFunctionCallBack callback, object paramsObject, dynamic entryDataObjectReturnedFromZome = null)
+ {
+ _currentId++;
+ return CallZomeFunctionAsync(_currentId.ToString(), zome, function, callback, paramsObject, true, false, entryDataObjectReturnedFromZome, ConductorResponseCallBackMode.UseCallBackEvents);
+ }
+
+ ///
+ /// This is the main method you will be using to invoke zome functions on your given zome. It has a number of handy overloads making it easier and more powerful to call your zome functions and manage the returned data. This method raises the OnDataReceived event and then either the OnZomeFunctionCallBack or OnSignalCallBack event once it has received a response from the Holochain conductor.
+ ///
+ /// The unique id you wish to assign for this call. This id is then returned in OnDataReceived, OnZomeFunctionCallBack and OnSignalCallBack events. There are overloads that omit this param, use these overloads if you wish HoloNET to auto-generate and manage the id's for you.
+ /// The name of the zome you wish to target.
+ /// The name of the zome function you wish to call.
+ /// A delegate to call once the zome function returns. This delegate contains the same signature as the one used for the OnZomeFunctionCallBack event. (optional param).
+ /// A basic CLR object containing the params the zome function is expecting (optional param).
+ /// This is an optional param, which defaults to true. Set this to true if you wish HoloNET to give the zome and zome function that made the call in the callback/event. If this is false then only the id will be given in the callback. This uses a small internal cache to match up the id to the given zome/function. Set this to false if you wish to save a tiny amount of memory by not utilizing this cache. If it is false then the `Zome` and `ZomeFunction` params will be missing in the ZomeCallBack, you will need to manually match the `id` to the call yourself. NOTE: If HoloNETDNA.EnforceRequestToResponseIdMatchingBehaviour is set to Warn or Error then this param will be ignored and the matching will always occur.
+ /// This is an optional param, which defaults to false. Set this to true if you wish HoloNET to cache the response retrieved from holochain. Subsequent calls will return this cached data rather than calling the Holochain conductor again. Use this for static data that is not going to change for performance gains.
+ /// This is an optional param, where the caller can pass in an instance of the dynamic data object they wish the entry data returned to be mapped to. This data object will then be returned in the ZomeFunctionCallBackEventArgs.Entry.EntryDataObject property.
+ ///
+ public ZomeFunctionCallBackEventArgs CallZomeFunction(string id, string zome, string function, ZomeFunctionCallBack callback, object paramsObject, bool matchIdToZomeFuncInCallback = true, bool cachReturnData = false, dynamic entryDataObjectReturnedFromZome = null)
+ {
+ _entryDataObjectLookup[id] = entryDataObjectReturnedFromZome;
+ return CallZomeFunctionAsync(id, zome, function, callback, paramsObject, matchIdToZomeFuncInCallback, cachReturnData, ConductorResponseCallBackMode.UseCallBackEvents).Result;
+ }
+
+ ///
+ /// This is the main method you will be using to invoke zome functions on your given zome. It has a number of handy overloads making it easier and more powerful to call your zome functions and manage the returned data. This method raises the OnDataReceived event and then either the OnZomeFunctionCallBack or OnSignalCallBack event once it has received a response from the Holochain conductor.
+ ///
+ /// The unique id you wish to assign for this call. This id is then returned in OnDataReceived, OnZomeFunctionCallBack and OnSignalCallBack events. There are overloads that omit this param, use these overloads if you wish HoloNET to auto-generate and manage the id's for you.
+ /// The name of the zome you wish to target.
+ /// The name of the zome function you wish to call.
+ /// A delegate to call once the zome function returns. This delegate contains the same signature as the one used for the OnZomeFunctionCallBack event. (optional param).
+ /// A basic CLR object containing the params the zome function is expecting (optional param).
+ /// This is an optional param, which defaults to true. Set this to true if you wish HoloNET to give the zome and zome function that made the call in the callback/event. If this is false then only the id will be given in the callback. This uses a small internal cache to match up the id to the given zome/function. Set this to false if you wish to save a tiny amount of memory by not utilizing this cache. If it is false then the `Zome` and `ZomeFunction` params will be missing in the ZomeCallBack, you will need to manually match the `id` to the call yourself. NOTE: If HoloNETDNA.EnforceRequestToResponseIdMatchingBehaviour is set to Warn or Error then this param will be ignored and the matching will always occur.
+ /// This is an optional param, which defaults to false. Set this to true if you wish HoloNET to cache the response retrieved from holochain. Subsequent calls will return this cached data rather than calling the Holochain conductor again. Use this for static data that is not going to change for performance gains.
+ /// This is an optional param, where the caller can pass in the type of the dynamic data object they wish the entry data returned to be mapped to. This newly created data object will then be returned in the ZomeFunctionCallBackEventArgs.Entry.EntryDataObject property.
+ ///
+ public ZomeFunctionCallBackEventArgs CallZomeFunction(string id, string zome, string function, ZomeFunctionCallBack callback, object paramsObject, bool matchIdToZomeFuncInCallback = true, bool cachReturnData = false, Type entryDataObjectTypeReturnedFromZome = null)
+ {
+ _entryDataObjectTypeLookup[id] = entryDataObjectTypeReturnedFromZome;
+ return CallZomeFunction(id, zome, function, callback, paramsObject, matchIdToZomeFuncInCallback, cachReturnData, ConductorResponseCallBackMode.UseCallBackEvents);
+ }
+
+ ///
+ /// This is the main method you will be using to invoke zome functions on your given zome. It has a number of handy overloads making it easier and more powerful to call your zome functions and manage the returned data. This method raises the OnDataReceived event and then either the OnZomeFunctionCallBack or OnSignalCallBack event once it has received a response from the Holochain conductor.
+ ///
+ /// The unique id you wish to assign for this call. This id is then returned in OnDataReceived, OnZomeFunctionCallBack and OnSignalCallBack events. There are overloads that omit this param, use these overloads if you wish HoloNET to auto-generate and manage the id's for you.
+ /// The name of the zome you wish to target.
+ /// The name of the zome function you wish to call.
+ /// A delegate to call once the zome function returns. This delegate contains the same signature as the one used for the OnZomeFunctionCallBack event. (optional param).
+ /// A basic CLR object containing the params the zome function is expecting (optional param).
+ /// This is an optional param, which defaults to true. Set this to true if you wish HoloNET to give the zome and zome function that made the call in the callback/event. If this is false then only the id will be given in the callback. This uses a small internal cache to match up the id to the given zome/function. Set this to false if you wish to save a tiny amount of memory by not utilizing this cache. If it is false then the `Zome` and `ZomeFunction` params will be missing in the ZomeCallBack, you will need to manually match the `id` to the call yourself. NOTE: If HoloNETDNA.EnforceRequestToResponseIdMatchingBehaviour is set to Warn or Error then this param will be ignored and the matching will always occur.
+ /// This is an optional param, which defaults to false. Set this to true if you wish HoloNET to cache the response retrieved from holochain. Subsequent calls will return this cached data rather than calling the Holochain conductor again. Use this for static data that is not going to change for performance gains.
+ ///
+ public ZomeFunctionCallBackEventArgs CallZomeFunction(string id, string zome, string function, ZomeFunctionCallBack callback, object paramsObject, bool matchIdToZomeFuncInCallback = true, bool cachReturnData = false)
+ {
+ return CallZomeFunctionAsync(id, zome, function, callback, paramsObject, matchIdToZomeFuncInCallback, cachReturnData, ConductorResponseCallBackMode.UseCallBackEvents).Result;
+ }
+ }
+}
\ No newline at end of file
diff --git a/NextGenSoftware.Holochain.HoloNET.Client/HoloNET Client/HoloNETClientBase/HoloNETClientBase - Requests.cs b/NextGenSoftware.Holochain.HoloNET.Client/HoloNET Client/HoloNETClientBase/HoloNETClientBase - Requests.cs
index e54a61d77..43c6bb046 100644
--- a/NextGenSoftware.Holochain.HoloNET.Client/HoloNET Client/HoloNETClientBase/HoloNETClientBase - Requests.cs
+++ b/NextGenSoftware.Holochain.HoloNET.Client/HoloNET Client/HoloNETClientBase/HoloNETClientBase - Requests.cs
@@ -4,6 +4,7 @@
using MessagePack;
using NextGenSoftware.Logging;
using NextGenSoftware.Holochain.HoloNET.Client.Interfaces;
+using System.Text.Json;
namespace NextGenSoftware.Holochain.HoloNET.Client
{
@@ -18,7 +19,16 @@ public abstract partial class HoloNETClientBase : IHoloNETClientBase
///
public virtual async Task SendHoloNETRequestAsync(HoloNETData holoNETData, HoloNETRequestType requestType, string id = "")
{
- await SendHoloNETRequestAsync(MessagePackSerializer.Serialize(holoNETData), requestType, id);
+ // Check if we should use JSON-RPC 2.0 protocol (Holochain 0.5.2)
+ if (HoloNETDNA?.HolochainVersion == HolochainVersion.Holochain_0_5_2)
+ {
+ await SendHoloNETRequestAsyncHolochain052(holoNETData, requestType, id);
+ }
+ else
+ {
+ // Use legacy MessagePack protocol (Redux/RSM)
+ await SendHoloNETRequestAsync(MessagePackSerializer.Serialize(holoNETData), requestType, id);
+ }
}
///
@@ -84,5 +94,103 @@ protected virtual string GetRequestId()
_currentId++;
return _currentId.ToString();
}
- }
-}
\ No newline at end of file
+
+ ///
+ /// Sends a request using JSON-RPC 2.0 protocol (Holochain 0.5.2)
+ ///
+ protected virtual async Task SendHoloNETRequestAsyncHolochain052(HoloNETData holoNETData, HoloNETRequestType requestType, string id = "")
+ {
+ try
+ {
+ if (string.IsNullOrEmpty(id))
+ id = GetRequestId();
+
+ // Create JSON-RPC 2.0 request
+ var jsonRpcRequest = new
+ {
+ jsonrpc = "2.0",
+ id = id,
+ method = GetJsonRpcMethod(requestType),
+ @params = new
+ {
+ data = holoNETData
+ }
+ };
+
+ // Serialize to JSON
+ string jsonString = JsonSerializer.Serialize(jsonRpcRequest, new JsonSerializerOptions
+ {
+ WriteIndented = false,
+ PropertyNamingPolicy = JsonNamingPolicy.CamelCase
+ });
+
+ Logger.Log($"JSON-RPC 2.0 Request: {jsonString}", LogType.Debug);
+
+ // Convert to bytes
+ byte[] jsonData = System.Text.Encoding.UTF8.GetBytes(jsonString);
+
+ if (HoloNETDNA.EnforceRequestToResponseIdMatchingBehaviour != EnforceRequestToResponseIdMatchingBehaviour.Ignore)
+ _pendingRequests.Add(id);
+
+ _requestTypeLookup[id] = requestType;
+
+ if (WebSocket.State == WebSocketState.Open)
+ {
+ Logger.Log("Sending JSON-RPC 2.0 Request to Holochain Conductor...", LogType.Info, true);
+ await WebSocket.SendRawDataAsync(jsonData);
+ Logger.Log("JSON-RPC 2.0 Request Successfully Sent To Holochain Conductor.", LogType.Info, false);
+ }
+ }
+ catch (Exception ex)
+ {
+ HandleError("Error occurred in HoloNETClient.SendHoloNETRequestAsyncHolochain052 method.", ex);
+ }
+ }
+
+ ///
+ /// Maps HoloNET request types to JSON-RPC 2.0 method names
+ ///
+ protected virtual string GetJsonRpcMethod(HoloNETRequestType requestType)
+ {
+ switch (requestType)
+ {
+ case HoloNETRequestType.ZomeCall:
+ return "call_zome";
+ case HoloNETRequestType.AppInfo:
+ return "app_info";
+ case HoloNETRequestType.AdminGenerateAgentPubKey:
+ return "admin_generate_agent_pub_key";
+ case HoloNETRequestType.AdminInstallApp:
+ return "admin_install_app";
+ case HoloNETRequestType.AdminUninstallApp:
+ return "admin_uninstall_app";
+ case HoloNETRequestType.AdminEnableApp:
+ return "admin_enable_app";
+ case HoloNETRequestType.AdminDisableApp:
+ return "admin_disable_app";
+ case HoloNETRequestType.AdminGrantZomeCallCapability:
+ return "admin_grant_zome_call_capability";
+ case HoloNETRequestType.AdminAttachAppInterface:
+ return "admin_attach_app_interface";
+ case HoloNETRequestType.AdminListApps:
+ return "admin_list_apps";
+ case HoloNETRequestType.AdminListDnas:
+ return "admin_list_dnas";
+ case HoloNETRequestType.AdminListCellIds:
+ return "admin_list_cell_ids";
+ case HoloNETRequestType.AdminListAppInterfaces:
+ return "admin_list_app_interfaces";
+ case HoloNETRequestType.AdminRegisterDna:
+ return "admin_register_dna";
+ case HoloNETRequestType.AdminGetDnaDefinition:
+ return "admin_get_dna_definition";
+ case HoloNETRequestType.AdminAgentInfo:
+ return "admin_agent_info";
+ case HoloNETRequestType.AdminAddAgentInfo:
+ return "admin_add_agent_info";
+ default:
+ return "unknown";
+ }
+ }
+}
+}
diff --git a/NextGenSoftware.Holochain.HoloNET.Client/HoloNET Client/HoloNETClientBase/HoloNETClientBase - Responses.cs b/NextGenSoftware.Holochain.HoloNET.Client/HoloNET Client/HoloNETClientBase/HoloNETClientBase - Responses.cs
index 66b96e63e..fff4cdc88 100644
--- a/NextGenSoftware.Holochain.HoloNET.Client/HoloNET Client/HoloNETClientBase/HoloNETClientBase - Responses.cs
+++ b/NextGenSoftware.Holochain.HoloNET.Client/HoloNET Client/HoloNETClientBase/HoloNETClientBase - Responses.cs
@@ -5,6 +5,7 @@
using NextGenSoftware.Utilities;
using NextGenSoftware.Utilities.ExtentionMethods;
using NextGenSoftware.Holochain.HoloNET.Client.Interfaces;
+using System.Text.Json;
namespace NextGenSoftware.Holochain.HoloNET.Client
{
@@ -84,6 +85,123 @@ protected virtual IHoloNETResponse DecodeDataReceived(byte[] rawBinaryData, WebS
IHoloNETResponse response = null;
HoloNETDataReceivedEventArgs holoNETDataReceivedEventArgs = new HoloNETDataReceivedEventArgs();
+ try
+ {
+ // Check if we should use JSON-RPC 2.0 protocol (Holochain 0.5.2)
+ if (HoloNETDNA?.HolochainVersion == HolochainVersion.Holochain_0_5_2)
+ {
+ return DecodeDataReceivedHolochain052(rawBinaryData, dataReceivedEventArgs);
+ }
+ else
+ {
+ // Use legacy MessagePack protocol (Redux/RSM)
+ return DecodeDataReceivedLegacy(rawBinaryData, dataReceivedEventArgs);
+ }
+ }
+ catch (Exception ex)
+ {
+ string msg = "Error in HoloNETClient.DecodeDataReceived method.";
+ HandleError(msg, ex);
+ }
+
+ return response;
+ }
+
+ ///
+ /// Decodes data received using JSON-RPC 2.0 protocol (Holochain 0.5.2)
+ ///
+ protected virtual IHoloNETResponse DecodeDataReceivedHolochain052(byte[] rawBinaryData, WebSocket.DataReceivedEventArgs dataReceivedEventArgs)
+ {
+ try
+ {
+ // Convert binary data to string for JSON parsing
+ string jsonString = DataHelper.DecodeBinaryDataAsUTF8(rawBinaryData);
+ Logger.Log($"JSON-RPC 2.0 Response: {jsonString}", LogType.Debug);
+
+ // Parse JSON-RPC 2.0 response
+ var jsonResponse = JsonSerializer.Deserialize(jsonString);
+
+ // Create HoloNET response object
+ var response = new HoloNETResponse();
+
+ // Extract JSON-RPC 2.0 fields
+ if (jsonResponse.TryGetProperty("id", out var idElement))
+ {
+ // Handle different id types (string, number, etc.)
+ if (idElement.ValueKind == JsonValueKind.String)
+ {
+ string idString = idElement.GetString();
+ if (ulong.TryParse(idString, out ulong idValue))
+ {
+ response.id = idValue;
+ }
+ else
+ {
+ response.id = 0; // Default value if parsing fails
+ }
+ }
+ else if (idElement.ValueKind == JsonValueKind.Number)
+ {
+ response.id = idElement.GetUInt64();
+ }
+ else
+ {
+ response.id = 0; // Default value for unknown types
+ }
+ }
+
+ if (jsonResponse.TryGetProperty("result", out var resultElement))
+ {
+ response.type = "success";
+ response.data = rawBinaryData; // Store original data for compatibility
+
+ // Parse the result to determine response type
+ if (resultElement.TryGetProperty("type", out var typeElement))
+ {
+ string resultType = typeElement.GetString();
+ switch (resultType)
+ {
+ case "zome_response":
+ response.HoloNETResponseType = HoloNETResponseType.ZomeResponse;
+ break;
+ case "signal":
+ response.HoloNETResponseType = HoloNETResponseType.Signal;
+ break;
+ case "app_info":
+ response.HoloNETResponseType = HoloNETResponseType.AppInfo;
+ break;
+ default:
+ response.HoloNETResponseType = HoloNETResponseType.Error;
+ break;
+ }
+ }
+ }
+ else if (jsonResponse.TryGetProperty("error", out var errorElement))
+ {
+ response.type = "error";
+ response.HoloNETResponseType = HoloNETResponseType.Error;
+ response.data = rawBinaryData;
+ }
+
+ Logger.Log($"JSON-RPC 2.0 Decoded - ID: {response.id}, Type: {response.type}, ResponseType: {response.HoloNETResponseType}", LogType.Info);
+ return response;
+ }
+ catch (Exception ex)
+ {
+ Logger.Log($"Error parsing JSON-RPC 2.0 response: {ex.Message}", LogType.Error);
+ // Fallback to legacy parsing if JSON parsing fails
+ return DecodeDataReceivedLegacy(rawBinaryData, dataReceivedEventArgs);
+ }
+ }
+
+ ///
+ /// Decodes data received using legacy MessagePack protocol (Redux/RSM)
+ ///
+ protected virtual IHoloNETResponse DecodeDataReceivedLegacy(byte[] rawBinaryData, WebSocket.DataReceivedEventArgs dataReceivedEventArgs)
+ {
+ IHoloNETResponse response = null;
+ HoloNETDataReceivedEventArgs holoNETDataReceivedEventArgs = new HoloNETDataReceivedEventArgs();
+
try
{
string id = "";
@@ -93,7 +211,6 @@ protected virtual IHoloNETResponse DecodeDataReceived(byte[] rawBinaryData, WebS
byte[] data = rawBinaryData.ToArray();
rawBinaryData.CopyTo(data, 0);
-
response = MessagePackSerializer.Deserialize(data, messagePackSerializerOptions);
AppResponse appResponse = MessagePackSerializer.Deserialize(response.data, messagePackSerializerOptions);
@@ -102,8 +219,6 @@ protected virtual IHoloNETResponse DecodeDataReceived(byte[] rawBinaryData, WebS
rawBinaryDataAfterMessagePackDecodeDecoded = DataHelper.DecodeBinaryDataAsUTF8(response.data);
Logger.Log($"Id: {response.id} Type: {response.type}: {response.type} Internal Type: {appResponse.type}", LogType.Info);
- //Logger.Log(string.Concat("Raw Data Bytes Received After MessagePack Decode: ", rawBinaryDataAfterMessagePackDecodeAsString), LogType.Debug);
- //Logger.Log(string.Concat("Raw Data Bytes Decoded After MessagePack Decode: ", rawBinaryDataAfterMessagePackDecodeDecoded), LogType.Debug);
switch (appResponse.type)
{
diff --git a/NextGenSoftware.Holochain.HoloNET.Client/HoloNET Client/HoloNETClientBase/HoloNETClientBase - Responses.cs.backup b/NextGenSoftware.Holochain.HoloNET.Client/HoloNET Client/HoloNETClientBase/HoloNETClientBase - Responses.cs.backup
new file mode 100644
index 000000000..66b96e63e
--- /dev/null
+++ b/NextGenSoftware.Holochain.HoloNET.Client/HoloNET Client/HoloNETClientBase/HoloNETClientBase - Responses.cs.backup
@@ -0,0 +1,356 @@
+using System;
+using System.Linq;
+using MessagePack;
+using NextGenSoftware.Logging;
+using NextGenSoftware.Utilities;
+using NextGenSoftware.Utilities.ExtentionMethods;
+using NextGenSoftware.Holochain.HoloNET.Client.Interfaces;
+
+namespace NextGenSoftware.Holochain.HoloNET.Client
+{
+ public abstract partial class HoloNETClientBase : IHoloNETClientBase
+ {
+ protected virtual IHoloNETResponse ProcessDataReceived(WebSocket.DataReceivedEventArgs dataReceivedEventArgs)
+ {
+ string rawBinaryDataAsString = "";
+ string rawBinaryDataDecoded = "";
+ IHoloNETResponse response = null;
+
+ try
+ {
+ rawBinaryDataAsString = DataHelper.ConvertBinaryDataToString(dataReceivedEventArgs.RawBinaryData);
+ rawBinaryDataDecoded = DataHelper.DecodeBinaryDataAsUTF8(dataReceivedEventArgs.RawBinaryData);
+
+ response = DecodeDataReceived(dataReceivedEventArgs.RawBinaryData, dataReceivedEventArgs);
+
+ if (response != null && !response.IsError)
+ {
+ switch (response.HoloNETResponseType)
+ {
+ case HoloNETResponseType.Error:
+ ProcessErrorReceivedFromConductor(response, dataReceivedEventArgs);
+ break;
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ string msg = "Error in HoloNETClient.ProcessDataReceived method.";
+ HandleError(msg, ex);
+ }
+
+ return response;
+ }
+
+ protected virtual string ProcessErrorReceivedFromConductor(IHoloNETResponse response, WebSocket.DataReceivedEventArgs dataReceivedEventArgs)
+ {
+ string msg = $"Error in HoloNETClient.ProcessErrorReceivedFromConductor method. Error received from Holochain Conductor: ";
+
+ if (response != null)
+ {
+ try
+ {
+ AppResponse appResponse = MessagePackSerializer.Deserialize(response.data, messagePackSerializerOptions);
+
+ if (appResponse != null)
+ msg = $"'{msg}{appResponse.type}: {appResponse.data["type"]}: {appResponse.data["data"]}.'";
+ else
+ msg = $"'{msg}{dataReceivedEventArgs.RawBinaryDataDecoded}'";
+ }
+ catch (Exception ex)
+ {
+ msg = $"'{msg}{dataReceivedEventArgs.RawBinaryDataDecoded}'";
+ }
+ }
+ else
+ msg = $"'{msg}{dataReceivedEventArgs.RawBinaryDataDecoded}'";
+
+ HandleError(msg, null);
+ return msg;
+ }
+
+ protected virtual T ProcessResponeError(IHoloNETResponse response, WebSocket.DataReceivedEventArgs dataReceivedEventArgs, string responseErrorType, string msg) where T : HoloNETDataReceivedBaseEventArgs, new()
+ {
+ Logger.Log($"{responseErrorType} ERROR", LogType.Error);
+ T args = CreateHoloNETArgs(response, dataReceivedEventArgs);
+ args.IsError = true;
+ //args.IsCallSuccessful = false;
+ args.Message = msg;
+ return args;
+ }
+
+ protected virtual IHoloNETResponse DecodeDataReceived(byte[] rawBinaryData, WebSocket.DataReceivedEventArgs dataReceivedEventArgs)
+ {
+ IHoloNETResponse response = null;
+ HoloNETDataReceivedEventArgs holoNETDataReceivedEventArgs = new HoloNETDataReceivedEventArgs();
+
+ try
+ {
+ string id = "";
+ string rawBinaryDataAfterMessagePackDecodeAsString = "";
+ string rawBinaryDataAfterMessagePackDecodeDecoded = "";
+
+ byte[] data = rawBinaryData.ToArray();
+ rawBinaryData.CopyTo(data, 0);
+
+
+ response = MessagePackSerializer.Deserialize(data, messagePackSerializerOptions);
+ AppResponse appResponse = MessagePackSerializer.Deserialize(response.data, messagePackSerializerOptions);
+
+ id = response.id.ToString();
+ rawBinaryDataAfterMessagePackDecodeAsString = DataHelper.ConvertBinaryDataToString(response.data);
+ rawBinaryDataAfterMessagePackDecodeDecoded = DataHelper.DecodeBinaryDataAsUTF8(response.data);
+
+ Logger.Log($"Id: {response.id} Type: {response.type}: {response.type} Internal Type: {appResponse.type}", LogType.Info);
+ //Logger.Log(string.Concat("Raw Data Bytes Received After MessagePack Decode: ", rawBinaryDataAfterMessagePackDecodeAsString), LogType.Debug);
+ //Logger.Log(string.Concat("Raw Data Bytes Decoded After MessagePack Decode: ", rawBinaryDataAfterMessagePackDecodeDecoded), LogType.Debug);
+
+ switch (appResponse.type)
+ {
+ case "zome-response":
+ response.HoloNETResponseType = HoloNETResponseType.ZomeResponse;
+ break;
+
+ case "signal":
+ response.HoloNETResponseType = HoloNETResponseType.Signal;
+ break;
+
+ case "app_info":
+ response.HoloNETResponseType = HoloNETResponseType.AppInfo;
+ break;
+
+ case "agent_pub_key_generated":
+ response.HoloNETResponseType = HoloNETResponseType.AdminAgentPubKeyGenerated;
+ break;
+
+ case "app_installed":
+ response.HoloNETResponseType = HoloNETResponseType.AdminAppInstalled;
+ break;
+
+ case "app_uninstalled":
+ response.HoloNETResponseType = HoloNETResponseType.AdminAppUninstalled;
+ break;
+
+ case "app_enabled":
+ response.HoloNETResponseType = HoloNETResponseType.AdminAppEnabled;
+ break;
+
+ case "app_disabled":
+ response.HoloNETResponseType = HoloNETResponseType.AdminAppDisabled;
+ break;
+
+ case "zome_call_capability_granted":
+ response.HoloNETResponseType = HoloNETResponseType.AdminZomeCallCapabilityGranted;
+ break;
+
+ case "app_interface_attached":
+ response.HoloNETResponseType = HoloNETResponseType.AdminAppInterfaceAttached;
+ break;
+
+ case "apps_listed":
+ response.HoloNETResponseType = HoloNETResponseType.AdminAppsListed;
+ break;
+
+ case "dnas_listed":
+ response.HoloNETResponseType = HoloNETResponseType.AdminDnasListed;
+ break;
+
+ case "cell_ids_listed":
+ response.HoloNETResponseType = HoloNETResponseType.AdminCellIdsListed;
+ break;
+
+ case "app_interfaces_listed":
+ response.HoloNETResponseType = HoloNETResponseType.AdminAppInterfacesListed;
+ break;
+
+ case "dna_registered":
+ response.HoloNETResponseType = HoloNETResponseType.AdminDnaRegistered;
+ break;
+
+ case "dna_definition_returned":
+ response.HoloNETResponseType = HoloNETResponseType.AdminDnaDefinitionReturned;
+ break;
+
+ case "agent_info":
+ response.HoloNETResponseType = HoloNETResponseType.AdminAgentInfoReturned;
+ break;
+
+ case "agent_info_added":
+ response.HoloNETResponseType = HoloNETResponseType.AdminAgentInfoAdded;
+ break;
+
+ case "coordinators_updated":
+ response.HoloNETResponseType = HoloNETResponseType.AdminCoordinatorsUpdated;
+ break;
+
+ case "clone_cell_deleted":
+ response.HoloNETResponseType = HoloNETResponseType.AdminCloneCellDeleted;
+ break;
+
+ case "state_dumped":
+ response.HoloNETResponseType = HoloNETResponseType.AdminStateDumped;
+ break;
+
+ case "full_state_dumped":
+ response.HoloNETResponseType = HoloNETResponseType.AdminFullStateDumped;
+ break;
+
+ case "network_metrics_dumped":
+ response.HoloNETResponseType = HoloNETResponseType.AdminNetworkMetricsDumped;
+ break;
+
+ case "network_stats_dumped":
+ response.HoloNETResponseType = HoloNETResponseType.AdminNetworkStatsDumped;
+ break;
+
+ case "network_storage_info":
+ response.HoloNETResponseType = HoloNETResponseType.AdminStorageInfoReturned;
+ break;
+
+ case "records_grafted":
+ response.HoloNETResponseType = HoloNETResponseType.AdminRecordsGrafted;
+ break;
+
+ case "admin_interfaces_added":
+ response.HoloNETResponseType = HoloNETResponseType.AdminAdminInterfacesAdded;
+ break;
+
+ case "error":
+ response.HoloNETResponseType = HoloNETResponseType.Error;
+ break;
+ }
+
+ holoNETDataReceivedEventArgs = CreateHoloNETArgs(response, dataReceivedEventArgs);
+
+ if (HoloNETDNA.EnforceRequestToResponseIdMatchingBehaviour != EnforceRequestToResponseIdMatchingBehaviour.Ignore
+ && !_pendingRequests.Contains(id))
+ {
+ holoNETDataReceivedEventArgs.IsError = HoloNETDNA.EnforceRequestToResponseIdMatchingBehaviour == EnforceRequestToResponseIdMatchingBehaviour.Error;
+ //holoNETDataReceivedEventArgs.IsCallSuccessful = false;
+ holoNETDataReceivedEventArgs.Message = $"The id returned in the response ({id}) does not match any pending request.";
+
+ if (holoNETDataReceivedEventArgs.IsError)
+ holoNETDataReceivedEventArgs.Message = string.Concat(holoNETDataReceivedEventArgs.Message, " HoloNETDNA.EnforceRequestToResponseIdMatchingBehaviour is set to Error so Aborting Request.");
+ }
+
+ _pendingRequests.Remove(id);
+ response.IsError = holoNETDataReceivedEventArgs.IsError;
+ }
+ catch (Exception ex)
+ {
+ string msg = $"An unknown error occurred in HoloNETClient.DecodeDataReceived. Reason: {ex}";
+ holoNETDataReceivedEventArgs.IsError = true;
+ holoNETDataReceivedEventArgs.Message = msg;
+ //holoNETDataReceivedEventArgs.IsCallSuccessful = false;
+ HandleError(msg, ex);
+ }
+
+ OnDataReceived?.Invoke(this, holoNETDataReceivedEventArgs);
+ return response;
+ }
+
+ protected virtual AppInfo ProcessAppInfo(AppInfo appInfo, AppInfoCallBackEventArgs args, bool log = true)
+ {
+ if (appInfo != null)
+ {
+ string agentPubKey = ConvertHoloHashToString(appInfo.agent_pub_key);
+ string agentPubKeyFromCell = "";
+ string dnaHash = "";
+
+ if (appInfo.cell_info != null)
+ {
+ var first = appInfo.cell_info.First();
+
+ if (first.Value != null && first.Value.Count > 0 && first.Value[0].Provisioned != null && first.Value[0].Provisioned.cell_id != null && first.Value[0].Provisioned.cell_id.Length == 2 && first.Value[0].Provisioned.cell_id[0] != null && first.Value[0].Provisioned.cell_id[1] != null)
+ {
+ agentPubKeyFromCell = ConvertHoloHashToString(first.Value[0].Provisioned.cell_id[1]);
+ dnaHash = ConvertHoloHashToString(first.Value[0].Provisioned.cell_id[0]);
+ appInfo.CellId = first.Value[0].Provisioned.cell_id;
+ args.CellId = appInfo.CellId;
+
+ if (agentPubKeyFromCell != agentPubKey)
+ {
+ args.Message = $"Error occured in HoloNETClient.ProcessAppInfo. appInfoResponse.data.agent_pub_key and agentPubKey dervived from cell data do not match! appInfoResponse.data.agent_pub_key = {agentPubKey}, cellData = {agentPubKeyFromCell} ";
+ args.IsError = true;
+ }
+
+ //Conductor time is in microseconds so we need to multiple it by 10 to get the ticks needed to convert it to a DateTime.
+ //Also UNIX dateime (which hc uses) starts from 1970).
+ first.Value[0].Provisioned.dna_modifiers.OriginTime = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc).AddTicks(first.Value[0].Provisioned.dna_modifiers.origin_time * 10);
+ }
+ }
+
+ if (_updateDnaHashAndAgentPubKey)
+ {
+ if (!string.IsNullOrEmpty(agentPubKey))
+ HoloNETDNA.AgentPubKey = agentPubKey;
+
+ if (!string.IsNullOrEmpty(dnaHash))
+ HoloNETDNA.DnaHash = dnaHash;
+
+ if (args.CellId != null)
+ HoloNETDNA.CellId = args.CellId;
+ }
+
+ if (log)
+ Logger.Log($"hAPP {appInfo.installed_app_id}: AgentPubKey: {agentPubKey}, DnaHash: {dnaHash}", LogType.Info);
+
+ args.AgentPubKey = agentPubKey;
+ args.DnaHash = dnaHash;
+ args.InstalledAppId = appInfo.installed_app_id;
+ appInfo.AgentPubKey = agentPubKey;
+ appInfo.DnaHash = dnaHash;
+
+ if (appInfo.manifest != null)
+ {
+ if (appInfo.manifest.roles != null && appInfo.manifest.roles.Length > 0)
+ {
+ //string strategy = appInfo.manifest.roles[0].provisioning.strategy.ToPascalCase();
+
+ if (appInfo.manifest.roles[0].provisioning != null)
+ appInfo.manifest.roles[0].provisioning.StrategyType = (ProvisioningStrategyType)Enum.Parse(typeof(ProvisioningStrategyType), appInfo.manifest.roles[0].provisioning.strategy.ToPascalCase());
+ }
+ }
+ }
+ else
+ {
+ args.Message = "Error occured in HoloNETClient.ProcessAppInfo. appInfo is null.";
+ args.IsError = true;
+ }
+
+ return appInfo;
+ }
+
+ protected virtual T CreateHoloNETArgs(IHoloNETResponse response, WebSocket.DataReceivedEventArgs dataReceivedEventArgs) where T : HoloNETDataReceivedBaseEventArgs, new()
+ {
+ return new T()
+ {
+ EndPoint = dataReceivedEventArgs != null ? dataReceivedEventArgs.EndPoint : null,
+ Id = response != null ? response.id.ToString() : "",
+ //IsCallSuccessful = true,
+ RawBinaryData = dataReceivedEventArgs != null ? dataReceivedEventArgs.RawBinaryData : null,
+ RawBinaryDataAsString = dataReceivedEventArgs != null ? dataReceivedEventArgs.RawBinaryDataAsString : "",
+ RawBinaryDataDecoded = dataReceivedEventArgs != null ? dataReceivedEventArgs.RawBinaryDataDecoded : "",
+ RawJSONData = dataReceivedEventArgs != null ? dataReceivedEventArgs.RawJSONData : "",
+ WebSocketResult = dataReceivedEventArgs != null ? dataReceivedEventArgs.WebSocketResult : null
+ };
+ }
+
+ protected virtual T1 CopyHoloNETArgs(T1 sourceArgs, T1 targetArgs) where T1 : HoloNETDataReceivedBaseEventArgs
+ {
+ targetArgs.EndPoint = sourceArgs.EndPoint;
+ targetArgs.Exception = sourceArgs.Exception;
+ targetArgs.Id = sourceArgs.Id;
+ //targetArgs.IsCallSuccessful = sourceArgs.IsCallSuccessful;
+ targetArgs.IsError = sourceArgs.IsError;
+ targetArgs.Message = sourceArgs.Message;
+ targetArgs.RawBinaryData = sourceArgs.RawBinaryData;
+ targetArgs.RawBinaryDataDecoded = sourceArgs.RawBinaryDataDecoded;
+ targetArgs.RawBinaryDataAsString = sourceArgs.RawBinaryDataAsString;
+ targetArgs.RawJSONData = sourceArgs.RawJSONData;
+ targetArgs.WebSocketResult = sourceArgs.WebSocketResult;
+
+ return targetArgs;
+ }
+ }
+}
\ No newline at end of file
diff --git a/NextGenSoftware.Holochain.HoloNET.Client/HoloNET DNA/HoloNETDNA.cs b/NextGenSoftware.Holochain.HoloNET.Client/HoloNET DNA/HoloNETDNA.cs
index 3724f5ecc..9fedb31a0 100644
--- a/NextGenSoftware.Holochain.HoloNET.Client/HoloNET DNA/HoloNETDNA.cs
+++ b/NextGenSoftware.Holochain.HoloNET.Client/HoloNET DNA/HoloNETDNA.cs
@@ -218,6 +218,10 @@ public LoggingMode ConsoleLoggingMode
//TODO: Possibly add these as defaults (used for the Connect methods).
//retrieveAgentPubKeyAndDnaHashMode
+ ///
+ /// The version of Holochain to use. This determines the protocol and API version for communication with the Holochain conductor.
+ ///
+ public HolochainVersion HolochainVersion { get; set; } = HolochainVersion.Holochain_0_5_2;
//retrieveAgentPubKeyAndDnaHashFromConductor
//retrieveAgentPubKeyAndDnaHashFromSandbox
//automaticallyAttemptToRetrieveFromConductorIfSandBoxFails
diff --git a/NextGenSoftware.Holochain.HoloNET.Client/Interfaces/IHoloNETDNA.cs b/NextGenSoftware.Holochain.HoloNET.Client/Interfaces/IHoloNETDNA.cs
index 664c233af..11b2099dd 100644
--- a/NextGenSoftware.Holochain.HoloNET.Client/Interfaces/IHoloNETDNA.cs
+++ b/NextGenSoftware.Holochain.HoloNET.Client/Interfaces/IHoloNETDNA.cs
@@ -29,6 +29,7 @@ public interface IHoloNETDNA
string InstalledAppId { get; set; }
string LogFileName { get; set; }
LoggingMode FileLoggingMode { get; set; }
+ HolochainVersion HolochainVersion { get; set; }
LoggingMode ConsoleLoggingMode { get; set; }
string LogPath { get; set; }
bool LogToConsole { get; set; }
diff --git a/NextGenSoftware.Holochain.HoloNET.Client/NextGenSoftware.Holochain.HoloNET.Client.csproj b/NextGenSoftware.Holochain.HoloNET.Client/NextGenSoftware.Holochain.HoloNET.Client.csproj
index 691d9ff83..5e02e757c 100644
--- a/NextGenSoftware.Holochain.HoloNET.Client/NextGenSoftware.Holochain.HoloNET.Client.csproj
+++ b/NextGenSoftware.Holochain.HoloNET.Client/NextGenSoftware.Holochain.HoloNET.Client.csproj
@@ -1,7 +1,7 @@
- net8.0
+ net9.0
NextGenSoftware.Holochain.HoloNET.Client
@@ -138,9 +138,9 @@
-
-
-
+
+
+
diff --git a/NextGenSoftware.Holochain.HoloNET.Client/NextGenSoftware.Holochain.HoloNET.Client.csproj.backup b/NextGenSoftware.Holochain.HoloNET.Client/NextGenSoftware.Holochain.HoloNET.Client.csproj.backup
new file mode 100644
index 000000000..b293790d0
--- /dev/null
+++ b/NextGenSoftware.Holochain.HoloNET.Client/NextGenSoftware.Holochain.HoloNET.Client.csproj.backup
@@ -0,0 +1,146 @@
+
+
+
+ net8.0
+
+
+ NextGenSoftware.Holochain.HoloNET.Client
+ NextGen Software Ltd
+ HoloNET Holochain Client
+ HoloNET Holochain Client
+ The world's first .NET & Unity client for Holochain.
+ The world's first .NET & Unity client for Holochain.
+
+ https://github.com/holochain-open-dev/holochain-client-csharp
+ hc logo.png
+ David Ellams (NextGen Software Ltd)
+ holochain;net;unity;client
+
+ - This release has multiple bug fixes.
+ - Bug fixes for Get DNA Definition Conductor API function.
+ - Bug fixes for Disconnect and Re-Connect issues.
+ - Dependencies updated such as the NextGen Libs it uses.
+
+ [HoloNET Manager v3.1.0](https://www.oasisweb4.com/downloads/HoloNET_Manager_v3.1.0.msi)
+
+ **This is the UI to HoloNET and is also used to demo and test all functionality of HoloNET Client and HoloNET ORM. Read more about this above.**
+
+ **Please leave feedback in our [Telegram group](https://t.me/holonetchat). We are aware of a few bugs we are still working on, we originally wanted to wait till we got these fixed but if we are being honest we couldn't wait any longer to get this out there to get early feedback and see where the demands were for further features, enhancements and what part of the HoloNET Family we should focus more on etc...**
+
+ **We also REALLY need funding to keep this vital project alive, we are now out of runway so we would really appreciate your support:
+
+ https://www.gofundme.com/f/help-david-get-over-the-line-with-holonet-oasis-and-star**
+
+ **We also wanted help squishing these last few bugs because they have been quite tricky little buggers to track down! Please find them in our [GitHub Issues](https://github.com/holochain-open-dev/holochain-client-csharp/issues)... :)**
+
+ **Any other help would also be greatly appreciated, we are always looking for devs (and non devs) to join us on this exciting journey to the stars... We would love to hear from you! Thank you! :)**
+
+ **UPDATE: We have now opened our HoloNET Alpha Testers Programme, please get in touch on our [Telegram group](https://t.me/holonetchat) if you want to join and become one of our esteem amazing testers! You can also get early access to many exciting upcoming releases for HoloNET, STAR, OASIS & AR World/Our World before anyone else! Other perks and bonuses also available! So sign up now! Thanks!**
+
+ **NOTE: The documentation is still for the previous version, please bare with us while we update this soon... thank you!**
+
+ *Full Changelog:* https://github.com/holochain-open-dev/holochain-client-csharp/compare/v3.0.3...v3.0.5
+
+ NuGet Packages:
+
+ [NextGenSoftware.Holochain.HoloNET.Client](https://www.nuget.org/packages/NextGenSoftware.Holochain.HoloNET.Client)
+ Lightweight version that does not come with the holochain binaries (hc.exe and holochain.exe).
+
+ [NextGenSoftware.Holochain.HoloNET.Client.Embedded](https://www.nuget.org/packages/NextGenSoftware.Holochain.HoloNET.Client.Embedded)
+ This version comes with the holochain binaries (hc.exe and holochain.exe) integrated.
+
+ [NextGenSoftware.Holochain.HoloNET.Client.TestHarness](https://www.nuget.org/packages/NextGenSoftware.Holochain.HoloNET.Client.TestHarness)
+ A console test harness for HoloNET Client.
+
+ [NextGenSoftware.Holochain.HoloNET.ORM](https://www.nuget.org/packages/NextGenSoftware.Holochain.HoloNET.ORM)
+ The new HoloNET ORM (Object Relational Mapping) allowing very easy & rapid development of hApps. This consists of the HoloNETEntryBase, HoloNETAuditEntryBase, HoloNETCollection and HoloNETObservsableCollection classes. The first two can be extended to create your HoloNET Entry models that map directly onto your data structs in your rust hApp zome code. The second two are collections of these entries. You can then simply call basic CRUD methods on your classes such as Load, Save, Delete, etc making it very quick and easy to build hApps without having to worry about the lower complexities of Holochain or configure and use the Holochain Conductor or API's. You also get change tracking, version control & rollback functionality for free. HoloNET ORM allows any existing .net app/website/game/service to be rapidly and quickly converted to a Holochain hApp with very little code changes (you can simply add a new attribute to the properties in your models) and it will now map to your rust hApp structs (which WEB5 [NextGenSoftware.OASIS.STAR](https://www.nuget.org/packages/NextGenSoftware.OASIS.STAR)) can also dynamically generate (it generates rust and c# code). More documentation will be coming soon for this...
+
+ [NextGenSoftware.Holochain.HoloNET.ORM.Embedded](https://www.nuget.org/packages/NextGenSoftware.Holochain.HoloNET.ORM.Embedded)
+ This is exactly the same as above except it is using the embedded version of the HoloNET Client so it is integrated with the Holochain Conductor binaries.
+
+ [NextGenSoftware.Holochain.HoloNET.Manager](https://www.nuget.org/packages/NextGenSoftware.Holochain.HoloNET.Manager)
+ The new UI to HoloNET Client & HoloNET ORM show casing all of their advanced features. This has many generic backend and UI components that can be used to allow other .net devs to rapidly construct their own .net hApps using HoloNET HDK (HoloNET Client, HoloNET ORM, HoloNET Manager, WEB5 STAR ODK/HDK & HoloNET HyperNET). The HoloNET Manager is currently implemented in WPF but we have plans to port this to Uno, MAUI & OpenSilver meaning it can run natively on Windows, Mac, Linux, TV's, IPads, tablets, android, IOS & web. The work for this has already begun so expect future releases soon...
+
+ [NextGenSoftware.Holochain.HoloNET.Manager.Embedded](https://www.nuget.org/packages/NextGenSoftware.Holochain.HoloNET.Manager.Embedded)
+ This is exactly the same as above except it is using the embedded version of the HoloNET Client so it is integrated with the Holochain Conductor binaries.
+
+ [NextGenSoftware.Holochain.HoloNET.HDK](https://www.nuget.org/packages/NextGenSoftware.Holochain.HoloNET.HDK)
+ The new HoloNET HDK consisting of HoloNET Client, HoloNET ORM, HoloNET Manager, WEB5 STAR ODK/HDK & HoloNET HyperNET. This package contains a plugin to the generic WEB5 STAR ODK No/Low Code Generator extending it so it can generate hApps from metadata built on top of the HoloNET Client/ORM. Release Coming Soon...
+
+ [NextGenSoftware.Holochain.HoloNET.HDK.Embedded](https://www.nuget.org/packages/NextGenSoftware.Holochain.HoloNET.HDK.Embedded)
+ This is exactly the same as above except it is using the embedded version of the HoloNET Client so it is integrated with the Holochain Conductor binaries.
+
+ [NextGenSoftware.OASIS.STAR](https://www.nuget.org/packages/NextGenSoftware.OASIS.STAR)
+ The new No/Low Code Generator allowing you to generate code for any supported OASIS Provider (web2 and web3) and currently supports Holochain, IPFS, Solana, EOS, Ethereum, Telos, SEEDS, MongoDB, SQLLite, Neo4j & Azure. The generated code runs on top of OASIS/STAR COSMIC ORM making it a very easy and powerful way to share data between any web2 or web3 provider. Release Coming Soon...
+
+ [NextGenSoftware.Holochain.HoloNET.HyperNET](https://www.nuget.org/packages/NextGenSoftware.Holochain.HoloNET.HyperNET)
+ This is built on top of the HoloNET Client & HoloNET ORM and allows Unity and Unreal games to implement lag free P2P networking allowing near unlimited number of players to play online smashing previous limitations on classic cloud/server hosting. Release Coming Soon...
+
+ [NextGenSoftware.Holochain.HoloNET.HyperNET.Embedded](https://www.nuget.org/packages/NextGenSoftware.Holochain.HoloNET.HyperNET.Embedded)
+ This is exactly the same as above except it is using the embedded version of the HoloNET Client so it is integrated with the Holochain Conductor binaries.
+
+
+ git
+ https://github.com/holochain-open-dev/holochain-client-csharp
+ Copyright © NextGen Software Ltd 2019 - 2024
+ README.md
+
+ MIT
+ True
+ 3.0.5
+
+
+ false
+
+ true
+
+
+
+
+ True
+ \
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ PreserveNewest
+
+
+ Never
+
+
+ Never
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/NextGenSoftware.Holochain.HoloNET.Client/NextGenSoftware.Holochain.HoloNET.Client.csproj.broken b/NextGenSoftware.Holochain.HoloNET.Client/NextGenSoftware.Holochain.HoloNET.Client.csproj.broken
new file mode 100644
index 000000000..b293790d0
--- /dev/null
+++ b/NextGenSoftware.Holochain.HoloNET.Client/NextGenSoftware.Holochain.HoloNET.Client.csproj.broken
@@ -0,0 +1,146 @@
+
+
+
+ net8.0
+
+
+ NextGenSoftware.Holochain.HoloNET.Client
+ NextGen Software Ltd
+ HoloNET Holochain Client
+ HoloNET Holochain Client
+ The world's first .NET & Unity client for Holochain.
+ The world's first .NET & Unity client for Holochain.
+
+ https://github.com/holochain-open-dev/holochain-client-csharp
+ hc logo.png
+ David Ellams (NextGen Software Ltd)
+ holochain;net;unity;client
+
+ - This release has multiple bug fixes.
+ - Bug fixes for Get DNA Definition Conductor API function.
+ - Bug fixes for Disconnect and Re-Connect issues.
+ - Dependencies updated such as the NextGen Libs it uses.
+
+ [HoloNET Manager v3.1.0](https://www.oasisweb4.com/downloads/HoloNET_Manager_v3.1.0.msi)
+
+ **This is the UI to HoloNET and is also used to demo and test all functionality of HoloNET Client and HoloNET ORM. Read more about this above.**
+
+ **Please leave feedback in our [Telegram group](https://t.me/holonetchat). We are aware of a few bugs we are still working on, we originally wanted to wait till we got these fixed but if we are being honest we couldn't wait any longer to get this out there to get early feedback and see where the demands were for further features, enhancements and what part of the HoloNET Family we should focus more on etc...**
+
+ **We also REALLY need funding to keep this vital project alive, we are now out of runway so we would really appreciate your support:
+
+ https://www.gofundme.com/f/help-david-get-over-the-line-with-holonet-oasis-and-star**
+
+ **We also wanted help squishing these last few bugs because they have been quite tricky little buggers to track down! Please find them in our [GitHub Issues](https://github.com/holochain-open-dev/holochain-client-csharp/issues)... :)**
+
+ **Any other help would also be greatly appreciated, we are always looking for devs (and non devs) to join us on this exciting journey to the stars... We would love to hear from you! Thank you! :)**
+
+ **UPDATE: We have now opened our HoloNET Alpha Testers Programme, please get in touch on our [Telegram group](https://t.me/holonetchat) if you want to join and become one of our esteem amazing testers! You can also get early access to many exciting upcoming releases for HoloNET, STAR, OASIS & AR World/Our World before anyone else! Other perks and bonuses also available! So sign up now! Thanks!**
+
+ **NOTE: The documentation is still for the previous version, please bare with us while we update this soon... thank you!**
+
+ *Full Changelog:* https://github.com/holochain-open-dev/holochain-client-csharp/compare/v3.0.3...v3.0.5
+
+ NuGet Packages:
+
+ [NextGenSoftware.Holochain.HoloNET.Client](https://www.nuget.org/packages/NextGenSoftware.Holochain.HoloNET.Client)
+ Lightweight version that does not come with the holochain binaries (hc.exe and holochain.exe).
+
+ [NextGenSoftware.Holochain.HoloNET.Client.Embedded](https://www.nuget.org/packages/NextGenSoftware.Holochain.HoloNET.Client.Embedded)
+ This version comes with the holochain binaries (hc.exe and holochain.exe) integrated.
+
+ [NextGenSoftware.Holochain.HoloNET.Client.TestHarness](https://www.nuget.org/packages/NextGenSoftware.Holochain.HoloNET.Client.TestHarness)
+ A console test harness for HoloNET Client.
+
+ [NextGenSoftware.Holochain.HoloNET.ORM](https://www.nuget.org/packages/NextGenSoftware.Holochain.HoloNET.ORM)
+ The new HoloNET ORM (Object Relational Mapping) allowing very easy & rapid development of hApps. This consists of the HoloNETEntryBase, HoloNETAuditEntryBase, HoloNETCollection and HoloNETObservsableCollection classes. The first two can be extended to create your HoloNET Entry models that map directly onto your data structs in your rust hApp zome code. The second two are collections of these entries. You can then simply call basic CRUD methods on your classes such as Load, Save, Delete, etc making it very quick and easy to build hApps without having to worry about the lower complexities of Holochain or configure and use the Holochain Conductor or API's. You also get change tracking, version control & rollback functionality for free. HoloNET ORM allows any existing .net app/website/game/service to be rapidly and quickly converted to a Holochain hApp with very little code changes (you can simply add a new attribute to the properties in your models) and it will now map to your rust hApp structs (which WEB5 [NextGenSoftware.OASIS.STAR](https://www.nuget.org/packages/NextGenSoftware.OASIS.STAR)) can also dynamically generate (it generates rust and c# code). More documentation will be coming soon for this...
+
+ [NextGenSoftware.Holochain.HoloNET.ORM.Embedded](https://www.nuget.org/packages/NextGenSoftware.Holochain.HoloNET.ORM.Embedded)
+ This is exactly the same as above except it is using the embedded version of the HoloNET Client so it is integrated with the Holochain Conductor binaries.
+
+ [NextGenSoftware.Holochain.HoloNET.Manager](https://www.nuget.org/packages/NextGenSoftware.Holochain.HoloNET.Manager)
+ The new UI to HoloNET Client & HoloNET ORM show casing all of their advanced features. This has many generic backend and UI components that can be used to allow other .net devs to rapidly construct their own .net hApps using HoloNET HDK (HoloNET Client, HoloNET ORM, HoloNET Manager, WEB5 STAR ODK/HDK & HoloNET HyperNET). The HoloNET Manager is currently implemented in WPF but we have plans to port this to Uno, MAUI & OpenSilver meaning it can run natively on Windows, Mac, Linux, TV's, IPads, tablets, android, IOS & web. The work for this has already begun so expect future releases soon...
+
+ [NextGenSoftware.Holochain.HoloNET.Manager.Embedded](https://www.nuget.org/packages/NextGenSoftware.Holochain.HoloNET.Manager.Embedded)
+ This is exactly the same as above except it is using the embedded version of the HoloNET Client so it is integrated with the Holochain Conductor binaries.
+
+ [NextGenSoftware.Holochain.HoloNET.HDK](https://www.nuget.org/packages/NextGenSoftware.Holochain.HoloNET.HDK)
+ The new HoloNET HDK consisting of HoloNET Client, HoloNET ORM, HoloNET Manager, WEB5 STAR ODK/HDK & HoloNET HyperNET. This package contains a plugin to the generic WEB5 STAR ODK No/Low Code Generator extending it so it can generate hApps from metadata built on top of the HoloNET Client/ORM. Release Coming Soon...
+
+ [NextGenSoftware.Holochain.HoloNET.HDK.Embedded](https://www.nuget.org/packages/NextGenSoftware.Holochain.HoloNET.HDK.Embedded)
+ This is exactly the same as above except it is using the embedded version of the HoloNET Client so it is integrated with the Holochain Conductor binaries.
+
+ [NextGenSoftware.OASIS.STAR](https://www.nuget.org/packages/NextGenSoftware.OASIS.STAR)
+ The new No/Low Code Generator allowing you to generate code for any supported OASIS Provider (web2 and web3) and currently supports Holochain, IPFS, Solana, EOS, Ethereum, Telos, SEEDS, MongoDB, SQLLite, Neo4j & Azure. The generated code runs on top of OASIS/STAR COSMIC ORM making it a very easy and powerful way to share data between any web2 or web3 provider. Release Coming Soon...
+
+ [NextGenSoftware.Holochain.HoloNET.HyperNET](https://www.nuget.org/packages/NextGenSoftware.Holochain.HoloNET.HyperNET)
+ This is built on top of the HoloNET Client & HoloNET ORM and allows Unity and Unreal games to implement lag free P2P networking allowing near unlimited number of players to play online smashing previous limitations on classic cloud/server hosting. Release Coming Soon...
+
+ [NextGenSoftware.Holochain.HoloNET.HyperNET.Embedded](https://www.nuget.org/packages/NextGenSoftware.Holochain.HoloNET.HyperNET.Embedded)
+ This is exactly the same as above except it is using the embedded version of the HoloNET Client so it is integrated with the Holochain Conductor binaries.
+
+
+ git
+ https://github.com/holochain-open-dev/holochain-client-csharp
+ Copyright © NextGen Software Ltd 2019 - 2024
+ README.md
+
+ MIT
+ True
+ 3.0.5
+
+
+ false
+
+ true
+
+
+
+
+ True
+ \
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ PreserveNewest
+
+
+ Never
+
+
+ Never
+
+
+
+
+
+
+
+
+
+
+
+
+
+