コード例 #1
0
 internal TokenMintTransactionBody(Hashgraph.Address token, ulong amount) : this()
 {
     if (amount < 1)
     {
         throw new ArgumentOutOfRangeException(nameof(amount), "The token amount must be greater than zero.");
     }
     Token  = new TokenID(token);
     Amount = amount;
 }
コード例 #2
0
 internal TokenWipeAccountTransactionBody(Hashgraph.Address token, Hashgraph.Address address, ulong amount) : this()
 {
     if (amount == 0)
     {
         throw new ArgumentOutOfRangeException(nameof(amount), "The amount to confiscate must be greater than zero.");
     }
     Token   = new TokenID(token);
     Account = new AccountID(address);
     Amount  = amount;
 }
コード例 #3
0
 internal TokenTransferList(Address token, Address fromAddress, Address toAddress, long amount) : this()
 {
     if (fromAddress is null)
     {
         throw new ArgumentNullException(nameof(toAddress), "Account to transfer from is missing. Please check that it is not null.");
     }
     if (toAddress is null)
     {
         throw new ArgumentNullException(nameof(toAddress), "Account to transfer to is missing. Please check that it is not null.");
     }
     if (amount < 1)
     {
         throw new ArgumentOutOfRangeException(nameof(amount), "The amount to transfer must be non-negative.");
     }
     Token = new TokenID(token);
     Transfers.Add(new AccountAmount(fromAddress, -amount));
     Transfers.Add(new AccountAmount(toAddress, amount));
 }
コード例 #4
0
 internal TokenGrantKycTransactionBody(Address token, Address address) : this()
 {
     Token   = new TokenID(token);
     Account = new AccountID(address);
 }
コード例 #5
0
 internal TokenGetInfoQuery(Address token) : this()
 {
     Token = new TokenID(token);
 }
コード例 #6
0
 internal TokenUnfreezeAccountTransactionBody(Address token, Address address) : this()
 {
     Token   = new TokenID(token);
     Account = new AccountID(address);
 }
コード例 #7
0
 internal CreateTokenReceipt FillProperties(TransactionID transactionId, CreateTokenReceipt receipt)
 {
     FillCommonProperties(transactionId, receipt);
     receipt.Token = TokenID.ToAddress();
     return(receipt);
 }
コード例 #8
0
 internal TokenDeleteTransactionBody(Address token) : this()
 {
     Token = new TokenID(token);
 }
コード例 #9
0
 internal TokenUpdateTransactionBody(Hashgraph.UpdateTokenParams updateParameters) : this()
 {
     if (updateParameters is null)
     {
         throw new ArgumentNullException(nameof(updateParameters), "Token Update Parameters argument is missing. Please check that it is not null.");
     }
     if (updateParameters.Token.IsNullOrNone())
     {
         throw new ArgumentNullException(nameof(updateParameters.Token), "The Token is missing.  Please check that it is not null or empty.");
     }
     if (updateParameters.Treasury is null &&
         updateParameters.Administrator is null &&
         updateParameters.GrantKycEndorsement is null &&
         updateParameters.SuspendEndorsement is null &&
         updateParameters.ConfiscateEndorsement is null &&
         updateParameters.SupplyEndorsement is null &&
         string.IsNullOrWhiteSpace(updateParameters.Symbol) &&
         string.IsNullOrWhiteSpace(updateParameters.Name) &&
         !updateParameters.Expiration.HasValue &&
         !updateParameters.RenewPeriod.HasValue &&
         updateParameters.RenewAccount is null &&
         updateParameters.Memo is null)
     {
         throw new ArgumentException("The Topic Updates contain no update properties, it is blank.", nameof(updateParameters));
     }
     Token = new TokenID(updateParameters.Token);
     if (!string.IsNullOrWhiteSpace(updateParameters.Symbol))
     {
         if (updateParameters.Symbol.Trim().Length != updateParameters.Symbol.Length)
         {
             throw new ArgumentOutOfRangeException(nameof(updateParameters.Symbol), "The new token symbol cannot contain leading or trailing white space.");
         }
         if (updateParameters.Symbol.Length > 32)
         {
             throw new ArgumentOutOfRangeException(nameof(updateParameters.Symbol), "The new token symbol cannot exceed 32 characters in length.");
         }
         if (!updateParameters.Symbol.Equals(updateParameters.Symbol.ToUpperInvariant()))
         {
             throw new ArgumentOutOfRangeException(nameof(updateParameters.Symbol), "The new token symbol must contain upper case characters.");
         }
         Symbol = updateParameters.Symbol;
     }
     if (!string.IsNullOrWhiteSpace(updateParameters.Name))
     {
         if (updateParameters.Name.Trim().Length != updateParameters.Name.Length)
         {
             throw new ArgumentOutOfRangeException(nameof(updateParameters.Name), "The new token name cannot contain leading or trailing white space.");
         }
         Name = updateParameters.Name;
     }
     if (updateParameters.Expiration.HasValue)
     {
         if (updateParameters.Expiration.Value < DateTime.UtcNow)
         {
             throw new ArgumentOutOfRangeException(nameof(updateParameters.Expiration), "The new expiration can not be set to the past.");
         }
         Expiry = new Timestamp(updateParameters.Expiration.Value);
     }
     if (updateParameters.RenewPeriod.HasValue)
     {
         if (updateParameters.RenewPeriod.Value.TotalSeconds < 1)
         {
             throw new ArgumentOutOfRangeException(nameof(updateParameters.RenewPeriod), "The renew period must be non negative.");
         }
         AutoRenewPeriod = new Duration(updateParameters.RenewPeriod.Value);
     }
     if (updateParameters.Memo is not null)
     {
         if (updateParameters.Memo.Trim().Length != updateParameters.Memo.Length)
         {
             throw new ArgumentOutOfRangeException(nameof(updateParameters.Memo), "The new token memo cannot contain leading or trailing white space.");
         }
         Memo = updateParameters.Memo;
     }
     if (!(updateParameters.Treasury is null))
     {
         Treasury = new AccountID(updateParameters.Treasury);
     }
     if (!(updateParameters.Administrator is null))
     {
         AdminKey = new Key(updateParameters.Administrator);
     }
     if (!(updateParameters.GrantKycEndorsement is null))
     {
         KycKey = new Key(updateParameters.GrantKycEndorsement);
     }
     if (!(updateParameters.SuspendEndorsement is null))
     {
         FreezeKey = new Key(updateParameters.SuspendEndorsement);
     }
     if (!(updateParameters.ConfiscateEndorsement is null))
     {
         WipeKey = new Key(updateParameters.ConfiscateEndorsement);
     }
     if (!(updateParameters.SupplyEndorsement is null))
     {
         SupplyKey = new Key(updateParameters.SupplyEndorsement);
     }
     if (!(updateParameters.RenewAccount is null))
     {
         AutoRenewAccount = new AccountID(updateParameters.RenewAccount);
     }
 }