コード例 #1
0
 internal FileCreateTransactionBody(Hashgraph.CreateFileParams createParameters) : this()
 {
     if (createParameters is null)
     {
         throw new ArgumentNullException(nameof(createParameters), "The create parameters are missing. Please check that the argument is not null.");
     }
     if (createParameters.Endorsements is null)
     {
         throw new ArgumentOutOfRangeException(nameof(createParameters.Endorsements), "Endorsements are required.");
     }
     ExpirationTime = new Timestamp(createParameters.Expiration);
     Keys           = new KeyList(createParameters.Endorsements);
     Contents       = ByteString.CopyFrom(createParameters.Contents.ToArray());
     Memo           = createParameters.Memo ?? "";
 }
コード例 #2
0
ファイル: Key.cs プロジェクト: sannynguyen/Hashgraph
 internal Endorsement ToEndorsement()
 {
     return(KeyCase switch
     {
         KeyOneofCase.Ed25519 => new Endorsement(KeyType.Ed25519, new ReadOnlyMemory <byte>(Ed25519Util.publicKeyPrefix.Concat(Ed25519.ToByteArray()).ToArray())),
         KeyOneofCase.RSA3072 => new Endorsement(KeyType.RSA3072, RSA3072.ToByteArray()),
         KeyOneofCase.ECDSA384 => new Endorsement(KeyType.ECDSA384, ECDSA384.ToByteArray()),
         KeyOneofCase.ContractID => new Endorsement(KeyType.Contract, Abi.EncodeAddressPart(ContractID.ToAddress())),
         KeyOneofCase.ThresholdKey => ThresholdKey.Keys.Keys.Count == 0 ? Endorsement.None : new Endorsement(ThresholdKey.Threshold, ThresholdKey.Keys.ToEndorsements()),
         KeyOneofCase.KeyList => KeyList.Keys.Count == 0 ? Endorsement.None : new Endorsement(KeyList.ToEndorsements()),
         _ => throw new InvalidOperationException($"Unknown Key Type {KeyCase}.  Do we have a network/library version mismatch?"),
     });