Class DaemonProxy
WebSocketRpcClient for the daemon interface. The daemon can be used to proxy messages to and from other chia services as well as controlling the PlotterProxy and having it's own procedures
public sealed class DaemonProxy : ServiceProxy, IServiceProxy
- Inheritance
-
DaemonProxy
- Implements
- Inherited Members
- Extension Methods
Remarks
ctor
Constructors
DaemonProxy(WebSocketRpcClient, string)
WebSocketRpcClient for the daemon interface. The daemon can be used to proxy messages to and from other chia services as well as controlling the PlotterProxy and having it's own procedures
public DaemonProxy(WebSocketRpcClient rpcClient, string originService)
Parameters
rpcClient
WebSocketRpcClientIRpcClient instance to use for rpc communication
originService
string
Remarks
ctor
Methods
AddPrivateKey(string, string, CancellationToken)
Adds a private key to the keychain, with the given entropy and passphrase. The keychain itself will store the public key, and the entropy bytes, but not the passphrase.
public Task<uint> AddPrivateKey(string mnemonic, string passphrase, CancellationToken cancellationToken = default)
Parameters
mnemonic
stringMnemonic entropy of the key
passphrase
stringKeyring passphrase
cancellationToken
CancellationTokenA token to allow the call to be cancelled
Returns
CheckKeys(string, CancellationToken)
Checks the keys
public Task CheckKeys(string rootPath, CancellationToken cancellationToken = default)
Parameters
rootPath
stringThe config root path
cancellationToken
CancellationTokenA token to allow the call to be cancelled
Returns
Remarks
This seems to send the daemon out to lunch
CreateProxyFrom<T>()
Create a new derived ServiceProxy instance sharing this daemon's RpcClient
public T CreateProxyFrom<T>() where T : ServiceProxy
Returns
- T
The ServiceProxy
Type Parameters
T
The type of ServiceProxy to create
Remarks
This only works for daemons because they can forward messages to other services through their WebSocketRpcClient
DeleteAllKeys(CancellationToken)
Deletes all keys from the keychain
public Task DeleteAllKeys(CancellationToken cancellationToken = default)
Parameters
cancellationToken
CancellationTokenA token to allow the call to be cancelled
Returns
DeleteKeyByFingerprint(uint, CancellationToken)
Deletes all keys which have the given public key fingerprint
public Task DeleteKeyByFingerprint(uint fingerprint, CancellationToken cancellationToken = default)
Parameters
fingerprint
uintThe fingerprint
cancellationToken
CancellationTokenA token to allow the call to be cancelled
Returns
DeleteLabel(uint, CancellationToken)
Removes the label assigned to the key with the given fingerprint.
public Task DeleteLabel(uint fingerprint, CancellationToken cancellationToken = default)
Parameters
fingerprint
uintThe fingerprint
cancellationToken
CancellationToken
Returns
Exit(CancellationToken)
Tells the daemon at the RPC endpoint to exit.
public Task Exit(CancellationToken cancellationToken = default)
Parameters
cancellationToken
CancellationTokenA token to allow the call to be cancelled
Returns
Remarks
There isn't a way to start the daemon remotely via RPC, so take care that you have access to the RPC host if needed
GetAllPrivateKeys(CancellationToken)
Returns all private keys as a tuple of key, and entropy bytes (i.e. mnemonic) for each key.
public Task<IEnumerable<PrivateKeyData>> GetAllPrivateKeys(CancellationToken cancellationToken = default)
Parameters
cancellationToken
CancellationTokenA token to allow the call to be cancelled
Returns
- Task<IEnumerable<PrivateKeyData>>
All of the PrivateKeys
GetFirstPrivateKey(CancellationToken)
Returns the first private key
public Task<PrivateKeyData> GetFirstPrivateKey(CancellationToken cancellationToken = default)
Parameters
cancellationToken
CancellationTokenA token to allow the call to be cancelled
Returns
- Task<PrivateKeyData>
The first PrivateKey
GetKey(uint, bool, CancellationToken)
Locates and returns KeyData matching the provided fingerprint
public Task<KeyData> GetKey(uint fingerprint, bool includeSecrets = false, CancellationToken cancellationToken = default)
Parameters
fingerprint
uintThe fingerprint
includeSecrets
boolInclude secrets
cancellationToken
CancellationToken
Returns
GetKeyForFingerprint(uint, CancellationToken)
Gets the private key associated with the given fingerprint
public Task<PrivateKeyData> GetKeyForFingerprint(uint fingerprint, CancellationToken cancellationToken = default)
Parameters
fingerprint
uintThe fingerprint
cancellationToken
CancellationTokenA token to allow the call to be cancelled
Returns
- Task<PrivateKeyData>
The PrivateKey
GetKeyringStatus(CancellationToken)
Retrieves the status of the keyring
public Task<KeyringStatus> GetKeyringStatus(CancellationToken cancellationToken = default)
Parameters
cancellationToken
CancellationTokenA token to allow the call to be cancelled
Returns
- Task<KeyringStatus>
Awaitable Task
GetKeys(uint, bool, CancellationToken)
Returns the KeyData of all keys which can be retrieved
public Task<IEnumerable<KeyData>> GetKeys(uint fingerprint, bool includeSecrets = false, CancellationToken cancellationToken = default)
Parameters
fingerprint
uintThe fingerprint
includeSecrets
boolInclude secrets
cancellationToken
CancellationToken
Returns
GetStatus(CancellationToken)
Get whether the genesis block has been initialized
public Task<bool> GetStatus(CancellationToken cancellationToken = default)
Parameters
cancellationToken
CancellationTokenA token to allow the call to be cancelled
Returns
GetVersion(CancellationToken)
Get the installed version of chia at the endpoint
public Task<string> GetVersion(CancellationToken cancellationToken = default)
Parameters
cancellationToken
CancellationTokenA token to allow the call to be cancelled
Returns
GetWalletAddresses(IEnumerable<uint>?, bool, uint, uint, CancellationToken)
Returns the list of addresses.
public Task<IDictionary<uint, IEnumerable<WalletAddress>>> GetWalletAddresses(IEnumerable<uint>? fingerprints = null, bool nonObserverDerivation = false, uint index = 0, uint count = 1, CancellationToken cancellationToken = default)
Parameters
fingerprints
IEnumerable<uint>nonObserverDerivation
boolindex
uintcount
uintcancellationToken
CancellationTokenA token to allow the call to be cancelled
Returns
- Task<IDictionary<uint, IEnumerable<WalletAddress>>>
A dictionary of fingerprints and WalletAddress
IsKeyringLocked(CancellationToken)
Determine if the keyring is locked
public Task<bool> IsKeyringLocked(CancellationToken cancellationToken = default)
Parameters
cancellationToken
CancellationTokenA token to allow the call to be cancelled
Returns
IsRunning(string, CancellationToken)
Determines if the named service is running.
public Task<bool> IsRunning(string service, CancellationToken cancellationToken = default)
Parameters
service
stringThe service name
cancellationToken
CancellationTokenA token to allow the call to be cancelled
Returns
OnEventMessage(Message)
protected override void OnEventMessage(Message msg)
Parameters
msg
Message
Ping(CancellationToken)
Sends ping message to the service
public Task Ping(CancellationToken cancellationToken = default)
Parameters
cancellationToken
CancellationTokenA token to allow the call to be cancelled
Returns
RegisterService(string, CancellationToken)
Registers this daemon to receive messages. This is needed to receive responses from services other than the daemon. This is not a ServiceNames but usually the name of the consumer application such as 'wallet_ui'
public Task RegisterService(string service, CancellationToken cancellationToken = default)
Parameters
service
stringThe name to register
cancellationToken
CancellationTokenA token to allow the call to be cancelled
Returns
RegisterService(CancellationToken)
Registers this WebSocket to receive messages using OriginService This is needed to receive responses from services other than the daemon.
public Task RegisterService(CancellationToken cancellationToken = default)
Parameters
cancellationToken
CancellationTokenA token to allow the call to be cancelled
Returns
RemoveKeyringPassphrase(string, CancellationToken)
Remove the key ring passphrase
public Task RemoveKeyringPassphrase(string currentPassphrase, CancellationToken cancellationToken = default)
Parameters
currentPassphrase
stringThe current keyring passphrase
cancellationToken
CancellationTokenA token to allow the call to be cancelled
Returns
RunningServices(CancellationToken)
Get the list of running services
public Task<IEnumerable<string>> RunningServices(CancellationToken cancellationToken = default)
Parameters
cancellationToken
CancellationTokenA token to allow the call to be cancelled
Returns
- Task<IEnumerable<string>>
A list of services
SetKeyringPassphrase(string, string, string, bool, CancellationToken)
Update the key ring passphrase
public Task SetKeyringPassphrase(string currentPassphrase, string newPassphrase, string passphraseHint, bool savePassphrase = false, CancellationToken cancellationToken = default)
Parameters
currentPassphrase
stringThe current keyring passphrase
newPassphrase
stringThe new keyring passphrase
passphraseHint
stringA passphrase hint
savePassphrase
boolShould the passphrase be saved
cancellationToken
CancellationTokenA token to allow the call to be cancelled
Returns
SetLabel(uint, string, CancellationToken)
Assigns the given label to the first key with the given fingerprint.
public Task SetLabel(uint fingerprint, string label, CancellationToken cancellationToken = default)
Parameters
fingerprint
uintThe fingerprint
label
stringThe label
cancellationToken
CancellationToken
Returns
StartService(string, CancellationToken)
Starts the named service.
public Task StartService(string service, CancellationToken cancellationToken = default)
Parameters
service
stringThe ServiceNames of the service
cancellationToken
CancellationTokenA token to allow the call to be cancelled
Returns
StopService(string, CancellationToken)
Stops the named service
public Task StopService(string service, CancellationToken cancellationToken = default)
Parameters
service
stringThe ServiceNames of the service
cancellationToken
CancellationTokenA token to allow the call to be cancelled
Returns
UnlockKeyring(string, CancellationToken)
Unlock the keyring
public Task UnlockKeyring(string key, CancellationToken cancellationToken = default)
Parameters
key
stringKeyring passphrase
cancellationToken
CancellationTokenA token to allow the call to be cancelled
Returns
ValidateKeyringPassphrase(string, CancellationToken)
Test the validity of a passphrase
public Task ValidateKeyringPassphrase(string key, CancellationToken cancellationToken = default)
Parameters
key
stringKeyring passphrase
cancellationToken
CancellationTokenA token to allow the call to be cancelled
Returns
Events
KeyringStatusChanged
Event raised when the keyring status changes
public event EventHandler<dynamic>? KeyringStatusChanged
Event Type
- EventHandler<dynamic>
- for the daemon interface. The daemon can be used to proxy messages to and from other chia services as well as controlling the and having it's own procedures
StateChanged
Event raised when the Daemon or Plotter changes state
public event EventHandler<dynamic>? StateChanged
Event Type
- EventHandler<dynamic>
- for the daemon interface. The daemon can be used to proxy messages to and from other chia services as well as controlling the and having it's own procedures