Struct KmdClient
A client for accessing the kmd service
Namespace: Algorand.Unity
Assembly: cs.temp.dll.dll
Syntax
public struct KmdClient : IKmdClient, IAlgoApiClient
Remarks
The kmd service is responsible for managing keys and wallets
Constructors
KmdClient(String, Header[])
Create a new kmd client
Declaration
public KmdClient(string address, params Header[] headers)
Parameters
| Type | Name | Description |
|---|---|---|
| String | address | url of the service, including the port, e.g. |
| Header[] | headers | extra headers to add to the requests. e.g. |
KmdClient(String, String, Header[])
Create a new kmd client
Declaration
public KmdClient(string address, string token = null, params Header[] headers)
Parameters
| Type | Name | Description |
|---|---|---|
| String | address | url of the service, including the port, e.g. |
| String | token | token used in authenticating to the service |
| Header[] | headers | extra headers to add to the requests. e.g. |
Properties
Address
Declaration
public string Address { get; }
Property Value
| Type | Description |
|---|---|
| String |
Headers
Declaration
public Header[] Headers { get; }
Property Value
| Type | Description |
|---|---|
| Header[] |
Token
Declaration
public string Token { get; }
Property Value
| Type | Description |
|---|---|
| String |
TokenHeader
Declaration
public string TokenHeader { get; }
Property Value
| Type | Description |
|---|---|
| String |
Methods
CreateWallet(PrivateKey, FixedString128Bytes, FixedString128Bytes, FixedString128Bytes)
Create a wallet
Declaration
public AlgoApiRequest.Sent<CreateWalletResponse> CreateWallet(PrivateKey masterDerivationKey, FixedString128Bytes walletDriverName, FixedString128Bytes walletName, FixedString128Bytes walletPassword)
Parameters
| Type | Name | Description |
|---|---|---|
| PrivateKey | masterDerivationKey | |
| FixedString128Bytes | walletDriverName | The driver used to store the wallets. Supported values are "sqlite" and "ledger". |
| FixedString128Bytes | walletName | |
| FixedString128Bytes | walletPassword |
Returns
| Type | Description |
|---|---|
| AlgoApiRequest.Sent<CreateWalletResponse> |
Remarks
Create a new wallet (collection of keys) with the given parameters.
DeleteKey(Address, FixedString128Bytes, FixedString128Bytes)
Deletes the key with the passed public key from the wallet.
Declaration
public AlgoApiRequest.Sent DeleteKey(Address address, FixedString128Bytes walletHandleToken, FixedString128Bytes walletPassword)
Parameters
| Type | Name | Description |
|---|---|---|
| Address | address | public key of the key to delete |
| FixedString128Bytes | walletHandleToken | |
| FixedString128Bytes | walletPassword |
Returns
| Type | Description |
|---|---|
| AlgoApiRequest.Sent |
DeleteMultisig(Address, FixedString128Bytes, FixedString128Bytes)
Deletes multisig preimage information for the passed address from the wallet.
Declaration
public AlgoApiRequest.Sent DeleteMultisig(Address address, FixedString128Bytes walletHandleToken, FixedString128Bytes walletPassword)
Parameters
| Type | Name | Description |
|---|---|---|
| Address | address | public key for the key to delete multisig preimage information |
| FixedString128Bytes | walletHandleToken | |
| FixedString128Bytes | walletPassword |
Returns
| Type | Description |
|---|---|
| AlgoApiRequest.Sent |
ExportKey(Address, FixedString128Bytes, FixedString128Bytes)
Export the secret key associated with the passed public key.
Declaration
public AlgoApiRequest.Sent<ExportKeyResponse> ExportKey(Address address, FixedString128Bytes walletHandleToken, FixedString128Bytes walletPassword)
Parameters
| Type | Name | Description |
|---|---|---|
| Address | address | public key of the key to export |
| FixedString128Bytes | walletHandleToken | |
| FixedString128Bytes | walletPassword |
Returns
| Type | Description |
|---|---|
| AlgoApiRequest.Sent<ExportKeyResponse> |
ExportMasterKey(FixedString128Bytes, FixedString128Bytes)
Export the master derivation key from the wallet. This key is a master "backup" key for the underlying wallet. With it, you can regenerate all of the wallets that have been generated with this wallet's POST /v1/key endpoint. This key will not allow you to recover keys imported from other wallets, however.
Declaration
public AlgoApiRequest.Sent<ExportMasterKeyResponse> ExportMasterKey(FixedString128Bytes walletHandleToken, FixedString128Bytes walletPassword)
Parameters
| Type | Name | Description |
|---|---|---|
| FixedString128Bytes | walletHandleToken | |
| FixedString128Bytes | walletPassword |
Returns
| Type | Description |
|---|---|
| AlgoApiRequest.Sent<ExportMasterKeyResponse> |
ExportMultisig(Address, FixedString128Bytes)
Given a multisig address whose preimage this wallet stores, returns the information used to generate the address, including public keys, threshold, and multisig version.
Declaration
public AlgoApiRequest.Sent<ExportMultisigResponse> ExportMultisig(Address address, FixedString128Bytes walletHandleToken)
Parameters
| Type | Name | Description |
|---|---|---|
| Address | address | public key for the key to export multisig preimage information |
| FixedString128Bytes | walletHandleToken |
Returns
| Type | Description |
|---|---|
| AlgoApiRequest.Sent<ExportMultisigResponse> |
GenerateKey(FixedString128Bytes, Optional<Boolean>)
Generates the next key in the deterministic key sequence (as determined by the master derivation key) and adds it to the wallet, returning the public key.
Declaration
public AlgoApiRequest.Sent<GenerateKeyResponse> GenerateKey(FixedString128Bytes walletHandleToken, Optional<bool> displayMnemonic = default(Optional<bool>))
Parameters
| Type | Name | Description |
|---|---|---|
| FixedString128Bytes | walletHandleToken | |
| Optional<Boolean> | displayMnemonic | whether or not to display the mnemonic |
Returns
| Type | Description |
|---|---|
| AlgoApiRequest.Sent<GenerateKeyResponse> |
GetSwaggerSpec()
Gets the current swagger spec.
Declaration
public AlgoApiRequest.Sent<AlgoApiObject> GetSwaggerSpec()
Returns
| Type | Description |
|---|---|
| AlgoApiRequest.Sent<AlgoApiObject> | The entire swagger spec in json. |
ImportKey(PrivateKey, FixedString128Bytes)
Import an externally generated key into the wallet. Note that if you wish to back up the imported key, you must do so by backing up the entire wallet database, because imported keys were not derived from the wallet's master derivation key.
Declaration
public AlgoApiRequest.Sent<ImportKeyResponse> ImportKey(PrivateKey privateKey, FixedString128Bytes walletHandleToken)
Parameters
| Type | Name | Description |
|---|---|---|
| PrivateKey | privateKey | key to import |
| FixedString128Bytes | walletHandleToken |
Returns
| Type | Description |
|---|---|
| AlgoApiRequest.Sent<ImportKeyResponse> |
ImportMultisig(Ed25519.PublicKey[], Byte, FixedString128Bytes, Byte)
Generates a multisig account from the passed public keys array and multisig metadata, and stores all of this in the wallet.
Declaration
public AlgoApiRequest.Sent<ImportMultisigResponse> ImportMultisig(Ed25519.PublicKey[] publicKeys, byte threshold, FixedString128Bytes walletHandleToken, byte version = 1)
Parameters
| Type | Name | Description |
|---|---|---|
| Ed25519.PublicKey[] | publicKeys | Public keys for the accounts used to sign |
| Byte | threshold | Number of valid signatures required |
| FixedString128Bytes | walletHandleToken | |
| Byte | version | Multisig version. This should always be set to 1. |
Returns
| Type | Description |
|---|---|
| AlgoApiRequest.Sent<ImportMultisigResponse> |
InitWalletHandleToken(FixedString128Bytes, FixedString128Bytes)
Initialize a wallet handle token
Declaration
public AlgoApiRequest.Sent<InitWalletHandleTokenResponse> InitWalletHandleToken(FixedString128Bytes walletId, FixedString128Bytes walletPassword)
Parameters
| Type | Name | Description |
|---|---|---|
| FixedString128Bytes | walletId | |
| FixedString128Bytes | walletPassword |
Returns
| Type | Description |
|---|---|
| AlgoApiRequest.Sent<InitWalletHandleTokenResponse> |
Remarks
Unlock the wallet and return a wallet handle token that can be used for subsequent operations. These tokens expire periodically and must be renewed. You can use WalletInfo(FixedString128Bytes) to see how much time remains until expiration, and renew it with RenewWalletHandleToken(FixedString128Bytes). When you're done, you can invalidate the token with ReleaseWalletHandleToken(FixedString128Bytes).
ListKeys(FixedString128Bytes)
Lists all of the public keys in this wallet. All of them have a stored private key.
Declaration
public AlgoApiRequest.Sent<ListKeysResponse> ListKeys(FixedString128Bytes walletHandleToken)
Parameters
| Type | Name | Description |
|---|---|---|
| FixedString128Bytes | walletHandleToken |
Returns
| Type | Description |
|---|---|
| AlgoApiRequest.Sent<ListKeysResponse> |
ListMultisig(FixedString128Bytes)
Lists all of the multisig accounts whose preimages this wallet stores
Declaration
public AlgoApiRequest.Sent<ListMultisigResponse> ListMultisig(FixedString128Bytes walletHandleToken)
Parameters
| Type | Name | Description |
|---|---|---|
| FixedString128Bytes | walletHandleToken |
Returns
| Type | Description |
|---|---|
| AlgoApiRequest.Sent<ListMultisigResponse> |
ListWallets()
List Wallets
Declaration
public AlgoApiRequest.Sent<ListWalletsResponse> ListWallets()
Returns
| Type | Description |
|---|---|
| AlgoApiRequest.Sent<ListWalletsResponse> |
Remarks
Lists all of the wallets that kmd is aware of.
ReleaseWalletHandleToken(FixedString128Bytes)
Release a wallet handle token
Declaration
public AlgoApiRequest.Sent ReleaseWalletHandleToken(FixedString128Bytes walletHandleToken)
Parameters
| Type | Name | Description |
|---|---|---|
| FixedString128Bytes | walletHandleToken |
Returns
| Type | Description |
|---|---|
| AlgoApiRequest.Sent |
Remarks
Invalidate the passed wallet handle token, making it invalid for use in subsequent requests.
RenameWallet(FixedString128Bytes, FixedString128Bytes, FixedString128Bytes)
Rename a wallet
Declaration
public AlgoApiRequest.Sent<RenameWalletResponse> RenameWallet(FixedString128Bytes walletId, FixedString128Bytes newName, FixedString128Bytes walletPassword)
Parameters
| Type | Name | Description |
|---|---|---|
| FixedString128Bytes | walletId | |
| FixedString128Bytes | newName | |
| FixedString128Bytes | walletPassword |
Returns
| Type | Description |
|---|---|
| AlgoApiRequest.Sent<RenameWalletResponse> |
Remarks
Rename the underlying wallet to something else
RenewWalletHandleToken(FixedString128Bytes)
Renew a wallet handle token
Declaration
public AlgoApiRequest.Sent<RenewWalletHandleTokenResponse> RenewWalletHandleToken(FixedString128Bytes walletHandleToken)
Parameters
| Type | Name | Description |
|---|---|---|
| FixedString128Bytes | walletHandleToken |
Returns
| Type | Description |
|---|---|
| AlgoApiRequest.Sent<RenewWalletHandleTokenResponse> |
Remarks
Renew a wallet handle token, increasing its expiration duration to its initial value
SignMultisig(MultisigSig, Ed25519.PublicKey, Byte[], FixedString128Bytes, FixedString128Bytes)
Sign a multisig transaction
Declaration
public AlgoApiRequest.Sent<SignMultisigResponse> SignMultisig(MultisigSig msig, Ed25519.PublicKey publicKey, byte[] transactionData, FixedString128Bytes walletHandleToken, FixedString128Bytes walletPassword)
Parameters
| Type | Name | Description |
|---|---|---|
| MultisigSig | msig | Current multisig signature object |
| Ed25519.PublicKey | publicKey | public key of the key to use to add a signature to the multisig |
| Byte[] | transactionData | transaction serialized as msgpack |
| FixedString128Bytes | walletHandleToken | |
| FixedString128Bytes | walletPassword |
Returns
| Type | Description |
|---|---|
| AlgoApiRequest.Sent<SignMultisigResponse> |
Remarks
Start a multisig signature, or add a signature to a partially completed multisig signature object.
SignProgram(Address, Byte[], FixedString128Bytes, FixedString128Bytes)
Sign program
Declaration
public AlgoApiRequest.Sent<SignProgramResponse> SignProgram(Address account, byte[] programData, FixedString128Bytes walletHandleToken, FixedString128Bytes walletPassword)
Parameters
| Type | Name | Description |
|---|---|---|
| Address | account | Account to sign the program with |
| Byte[] | programData | compiled program bytes |
| FixedString128Bytes | walletHandleToken | |
| FixedString128Bytes | walletPassword |
Returns
| Type | Description |
|---|---|
| AlgoApiRequest.Sent<SignProgramResponse> |
Remarks
Signs the passed program with a key from the wallet, determined by the account named in the request.
SignProgramMultisig(Address, Byte[], MultisigSig, Ed25519.PublicKey, FixedString128Bytes, FixedString128Bytes)
Sign a program for a multisig account
Declaration
public AlgoApiRequest.Sent<SignProgramMultisigResponse> SignProgramMultisig(Address msigAccount, byte[] programData, MultisigSig msig, Ed25519.PublicKey publicKey, FixedString128Bytes walletHandleToken, FixedString128Bytes walletPassword)
Parameters
| Type | Name | Description |
|---|---|---|
| Address | msigAccount | The address of the multisig account. See https://developer.algorand.org/docs/get-details/accounts/create/#multisignature |
| Byte[] | programData | compiled program bytes |
| MultisigSig | msig | current multisig signature object |
| Ed25519.PublicKey | publicKey | public key of the key to use to add a signature to the multisig |
| FixedString128Bytes | walletHandleToken | |
| FixedString128Bytes | walletPassword |
Returns
| Type | Description |
|---|---|
| AlgoApiRequest.Sent<SignProgramMultisigResponse> |
Remarks
Start a multisig signature, or add a signature to a partially completed multisig signature object.
SignTransaction(Address, Byte[], FixedString128Bytes, FixedString128Bytes)
Sign a transaction
Declaration
public AlgoApiRequest.Sent<SignTransactionResponse> SignTransaction(Address account, byte[] transactionData, FixedString128Bytes walletHandleToken, FixedString128Bytes walletPassword)
Parameters
| Type | Name | Description |
|---|---|---|
| Address | account | public key of the key to sign the transaction |
| Byte[] | transactionData | transaction serialized as msgpack |
| FixedString128Bytes | walletHandleToken | |
| FixedString128Bytes | walletPassword |
Returns
| Type | Description |
|---|---|
| AlgoApiRequest.Sent<SignTransactionResponse> |
Versions()
Retrieves the current version of the kmd service
Declaration
public AlgoApiRequest.Sent<VersionsResponse> Versions()
Returns
| Type | Description |
|---|---|
| AlgoApiRequest.Sent<VersionsResponse> |
WalletInfo(FixedString128Bytes)
Get wallet info
Declaration
public AlgoApiRequest.Sent<WalletInfoResponse> WalletInfo(FixedString128Bytes walletHandleToken)
Parameters
| Type | Name | Description |
|---|---|---|
| FixedString128Bytes | walletHandleToken |
Returns
| Type | Description |
|---|---|
| AlgoApiRequest.Sent<WalletInfoResponse> |
Remarks
Returns information about the wallet associated with the passed wallet handle token. Additionally returns expiration information about the token itself.