Class Endorsement
Represents the key signing requirements for various transactions available within the network.
Implements
Inherited Members
Namespace: Hiero
Assembly: Hiero.dll
Syntax
[JsonConverter(typeof(EndorsementConverter))]
public sealed class Endorsement : IEquatable<Endorsement>
Constructors
| Edit this page View SourceEndorsement(params Endorsement[])
Create a M of M required list of endorsements. All listed endorsements must be fulfilled to fulfill this endorsement.
Declaration
public Endorsement(params Endorsement[] endorsements)
Parameters
| Type | Name | Description |
|---|---|---|
| Endorsement[] | endorsements | A list of endorsements that must be fulfilled, may be a mix of individual public keys or additional sub-lists of individual keys. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | if endorsements is null |
Endorsement(EntityId)
Creates an endorsement representing a contract instance.
Declaration
public Endorsement(EntityId contract)
Parameters
| Type | Name | Description |
|---|---|---|
| EntityId | contract | The address of the contract instance. |
Endorsement(KeyType, ReadOnlyMemory<byte>)
Creates an endorsement representing a single key of a valid type. Will accept Ed25519, ECDSASecp256K1 key types.
Declaration
public Endorsement(KeyType type, ReadOnlyMemory<byte> publicKey)
Parameters
| Type | Name | Description |
|---|---|---|
| KeyType | type | The type of key the bytes represent. |
| ReadOnlyMemory<byte> | publicKey | The bytes for the public key. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentOutOfRangeException | If type passed into the constructor was not a valid single key type or not recognizable from supplied bytes. |
Endorsement(ReadOnlyMemory<byte>)
Convenience constructor converting a public key represented
in bytes into an
Endorsement
. Ed25519 and ECDSA Secp256K1 keys. If the bytes entered are not recognizable as either of these formats, an exception is thrown.
Declaration
public Endorsement(ReadOnlyMemory<byte> publicKey)
Parameters
| Type | Name | Description |
|---|---|---|
| ReadOnlyMemory<byte> | publicKey | Bytes representing a public Ed25519, ECDSA Secp256K1 key or ABI or Protobuf encoded Contract ID. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentOutOfRangeException |
is not recognizable as an Ed25519 ECDSA Secp256K1 public key or encoded contract id. |
Endorsement(uint, params Endorsement[])
Create a N of M required list of endorsements. Only
requiredCount
number of listed endorsements must be fulfilled to fulfill this endorsement.
Declaration
public Endorsement(uint requiredCount, params Endorsement[] endorsements)
Parameters
| Type | Name | Description |
|---|---|---|
| uint | requiredCount | The number of child endorsements that must be fulfilled in order to fulfill this endorsement. |
| Endorsement[] | endorsements | A list of candidate endorsements, may be a mix of individual public keys or additional sub-lists of individual keys. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | if endorsements is null |
| ArgumentOutOfRangeException | if the required amount is negative or greater than the number of endorsements |
Properties
| Edit this page View SourceContract
The endorsement address value held by this endorsement if it is
a Contract type. If it is a list or other key type the value
returned will be
None
.
Declaration
public EntityId Contract { get; }
Property Value
| Type | Description |
|---|---|
| EntityId |
List
Returns a list of child endorsements identified by this endorsement (of list type). If the endorsement is not of a list type, the list will be empty.
Declaration
public Endorsement[] List { get; }
Property Value
| Type | Description |
|---|---|
| Endorsement[] |
None
A special designation of an endorsement key that can't be created. It represents an "empty" list of keys, which the network will interpret as "clear all keys" from this setting (typically the value null is interpreted as "make no change"). In this way, it is possible to change a topic from mutable (which has an Administrator endorsement) to immutable (having no Administrator endorsement).
Declaration
public static Endorsement None { get; }
Property Value
| Type | Description |
|---|---|
| Endorsement |
RequiredCount
When this endorsement contains a list of child endorsements, this represents the number of child endorsements that must be fulfilled in order to consider this endorsement fulfilled.
Declaration
public uint RequiredCount { get; }
Property Value
| Type | Description |
|---|---|
| uint |
Type
The type of endorsement this object is. It either contains a representation of a public key or a list of child endorsements with a note of how many are required to be fulfilled for this endorsement to be fulfilled.
Declaration
public KeyType Type { get; }
Property Value
| Type | Description |
|---|---|
| KeyType |
Methods
| Edit this page View SourceEquals(Endorsement?)
Equality implementation.
Declaration
public bool Equals(Endorsement? other)
Parameters
| Type | Name | Description |
|---|---|---|
| Endorsement | other |
object to compare. |
Returns
| Type | Description |
|---|---|
| bool |
object. |
Equals(object?)
Equality implementation.
Declaration
public override bool Equals(object? obj)
Parameters
| Type | Name | Description |
|---|---|---|
| object | obj |
object to compare (if it is an
). |
Returns
| Type | Description |
|---|---|
| bool |
object, otherwise
. |
Overrides
| Edit this page View SourceGetHashCode()
Equality implementation.
Declaration
public override int GetHashCode()
Returns
| Type | Description |
|---|---|
| int |
|
Overrides
| Edit this page View SourceToBytes(KeyFormat)
The bytes of the public key held by this endorsement if it is an Ed25519 or ECDSA Secp256K1 key type. If it is a list or contract type, it can be extracted as HAPI protobuf.
Declaration
public ReadOnlyMemory<byte> ToBytes(KeyFormat keyFormat = KeyFormat.Default)
Parameters
| Type | Name | Description |
|---|---|---|
| KeyFormat | keyFormat |
Returns
| Type | Description |
|---|---|
| ReadOnlyMemory<byte> |
ToString()
Outputs a string representation of the endorsement.
Declaration
public override string ToString()
Returns
| Type | Description |
|---|---|
| string | The Hex encoding of the "Hedera" byte format for the endorsement. |
Overrides
| Edit this page View SourceVerify(ReadOnlyMemory<byte>, ReadOnlyMemory<byte>)
Determines if the given signature was generated by the private key that this Endorsement represents. Only works for key type endorsements.
Declaration
public bool Verify(ReadOnlyMemory<byte> data, ReadOnlyMemory<byte> signature)
Parameters
| Type | Name | Description |
|---|---|---|
| ReadOnlyMemory<byte> | data | The data bytes that were signed. |
| ReadOnlyMemory<byte> | signature | The signature generated for the given data bytes. |
Returns
| Type | Description |
|---|---|
| bool |
if the signature is valid for this data and the public key held by this endorsement. |
Exceptions
| Type | Condition |
|---|---|
| InvalidOperationException |
extension method instead. |
Operators
| Edit this page View Sourceoperator ==(Endorsement, Endorsement)
Equals implementation.
Declaration
public static bool operator ==(Endorsement left, Endorsement right)
Parameters
| Type | Name | Description |
|---|---|---|
| Endorsement | left |
argument. |
| Endorsement | right |
argument. |
Returns
| Type | Description |
|---|---|
| bool |
objects. |
implicit operator EntityId(Endorsement)
Implicit constructor converting an endorsement key alias into an
<pre><code class="lang-csharp">EntityId</code></pre>
.
Declaration
public static implicit operator EntityId(Endorsement endorsement)
Parameters
| Type | Name | Description |
|---|---|---|
| Endorsement | endorsement | The Key Alias value to wrap in an Entity ID |
Returns
| Type | Description |
|---|---|
| EntityId |
implicit operator Endorsement(ReadOnlyMemory<byte>)
Implicit constructor converting a public key represented
in bytes into an
Endorsement
. Ed25519 and ECDSA Secp256K1 keys are supported. If the bytes entered are not recognizable as either of these two types of keys an exception is thrown.
Declaration
public static implicit operator Endorsement(ReadOnlyMemory<byte> publicKey)
Parameters
| Type | Name | Description |
|---|---|---|
| ReadOnlyMemory<byte> | publicKey | Bytes representing a public Ed25519 or ECDSA Secp256K1 key. |
Returns
| Type | Description |
|---|---|
| Endorsement |
Exceptions
| Type | Condition |
|---|---|
| ArgumentOutOfRangeException |
is not recognizable as an Ed25519 or ECDSA Secp256K1 public key. |
operator !=(Endorsement, Endorsement)
Not equals implementation.
Declaration
public static bool operator !=(Endorsement left, Endorsement right)
Parameters
| Type | Name | Description |
|---|---|---|
| Endorsement | left |
argument. |
| Endorsement | right |
argument. |
Returns
| Type | Description |
|---|---|
| bool |
if the Key requirements are identical within each
object.
if they are not identical. |