-
public final class HolochainServiceAdminClient
-
-
Constructor Summary
Constructors Constructor Description HolochainServiceAdminClient(Activity activity, ComponentName serviceComponentName)
-
Method Summary
Modifier and Type Method Description final Unitstart(RuntimeNetworkConfigFfi config)Start the Holochain serviceThis must be called before connect()can be called.final Unitconnect()Connect to the Holochain service using the Admin API. final AppAuthFfisetupApp(InstallAppPayloadFfi installAppPayload, Boolean enableAfterInstall)Full process to setup a Holochain app. final AppAuthFficonnectSetupApp(InstallAppPayloadFfi installAppPayload, Boolean enableAfterInstall)Connects to service, waits for connection to be ready, and sets up an app. final Unitstop()Stops the Holochain service. final BooleanisReady()Checks if the service is ready to receive calls. final AppInfoFfiinstallApp(InstallAppPayloadFfi payload)Installs a Holochain app final BooleanisAppInstalled(String installedAppId)Checks if an app with the given app ID is installed. final UnituninstallApp(String installedAppId)Uninstalls an installed Holochain app. final AppInfoFfienableApp(String installedAppId)Enables an installed Holochain app. final UnitdisableApp(String installedAppId)Disables an installed Holochain app. final List<AppInfoFfi>listApps()Lists all installed Holochain apps in the conductor. final AppAuthFfiensureAppWebsocket(String installedAppId)Gets or creates an app websocket with authentication token. final ZomeCallFfisignZomeCall(ZomeCallUnsignedFfi args)Signs a zome call with the agent's private key. final UnitwaitForConnectReady(Long timeoutMs)Polls until connected to the service, or the timeout has elapsed. -
-
Constructor Detail
-
HolochainServiceAdminClient
HolochainServiceAdminClient(Activity activity, ComponentName serviceComponentName)
-
-
Method Detail
-
start
final Unit start(RuntimeNetworkConfigFfi config)
Start the Holochain service
This must be called before
connect()can be called.
-
connect
final Unit connect()
Connect to the Holochain service using the Admin API.
This must be called before using any functions on the Admin API binder.
-
setupApp
final AppAuthFfi setupApp(InstallAppPayloadFfi installAppPayload, Boolean enableAfterInstall)
Full process to setup a Holochain app.
This function will:
Check if the app is installed
If not installed, install it
Optionally optionally enable it
Ensure there is an app websocket and authentication for it
If an app is already installed, it will not be enabled automatically. It is only enabled after a successful install. The reasoning is that if an app is disabled after initial installation, it is assumed to have been manually disabled via the admin UI, which we don't want to override.
- Parameters:
installAppPayload- The payload containing app installation dataenableAfterInstall- Whether to enable the app after installation
-
connectSetupApp
final AppAuthFfi connectSetupApp(InstallAppPayloadFfi installAppPayload, Boolean enableAfterInstall)
Connects to service, waits for connection to be ready, and sets up an app.
Convenience method that combines connect(), waitForConnectReady(), and setupApp() into a single call.
- Parameters:
installAppPayload- The payload containing app installation dataenableAfterInstall- Whether to enable the app after installation
-
stop
final Unit stop()
Stops the Holochain service.
This will shutdown the Holochain conductor and stop the service process.
-
installApp
final AppInfoFfi installApp(InstallAppPayloadFfi payload)
Installs a Holochain app
- Parameters:
payload- The installation payload containing the app bundle and configuration
-
isAppInstalled
final Boolean isAppInstalled(String installedAppId)
Checks if an app with the given app ID is installed.
- Parameters:
installedAppId- The ID of the app to check
-
uninstallApp
final Unit uninstallApp(String installedAppId)
Uninstalls an installed Holochain app.
- Parameters:
installedAppId- The ID of the app to uninstall
-
enableApp
final AppInfoFfi enableApp(String installedAppId)
Enables an installed Holochain app.
- Parameters:
installedAppId- The ID of the app to enable
-
disableApp
final Unit disableApp(String installedAppId)
Disables an installed Holochain app.
- Parameters:
installedAppId- The ID of the app to disable
-
listApps
final List<AppInfoFfi> listApps()
Lists all installed Holochain apps in the conductor.
-
ensureAppWebsocket
final AppAuthFfi ensureAppWebsocket(String installedAppId)
Gets or creates an app websocket with authentication token.
- Parameters:
installedAppId- The ID of the app to create a websocket for
-
signZomeCall
final ZomeCallFfi signZomeCall(ZomeCallUnsignedFfi args)
Signs a zome call with the agent's private key.
This is required for making authenticated calls to Holochain zome functions.
- Parameters:
args- The unsigned zome call to sign
-
waitForConnectReady
final Unit waitForConnectReady(Long timeoutMs)
Polls until connected to the service, or the timeout has elapsed.
- Parameters:
timeoutMs- Maximum time to wait for connection in milliseconds (default: 100ms)
-
-
-
-