Esempio n. 1
0
        public void Setup()
        {
            //
            // observers

            SystemObserver.Setup(new IObserver<ISystemEvent>[] { new ConsoleObserver() });

            //
            // message router

            Router = new MemoryMessageRouter();

            Router.RegisterHandler<CreateAccount>(new CreateAccountHandler().Handle);
            Router.RegisterHandler<AccountCreated>(new AccountCreatedHandler().Handle);

            //
            // message bus

            var bus = new NullBus();
            CommandBus = bus;
            EventBus = bus;

            //
            // Queue Writer

            var queueWriter = new QueueWriterToBus(bus);

            //
            // Misc
            Sender = new MessageSender(new IQueueWriter[] { queueWriter });
            Identifier = new AccountID(Guid.NewGuid());
        }
Esempio n. 2
0
        public void aggregate_facotry_should_execute_store_and_dispatch()
        {
            // arrange
            var router = new MemoryMessageRouter();
            router.RegisterHandler<CreateAccount>(new CreateAccountHandler().Handle);

            var id = new AccountID(Guid.NewGuid());
            var storageFactory = new MemoryRecordStorageFactory();

            var bus = new MemoryBusWithRouter(router);
            var factory = new AccountFactory(bus, storageFactory);

            // act
            factory.ExecuteStoreDispatch(new CreateAccount(id));

            // assert
            var storage = storageFactory.GetOrCreateStorage(id);
            storage.GetRecords(0, int.MaxValue).Count().ShouldEqual(1);
        }
        public UGCQueryHandle CreateQueryUserUGCRequest(AccountID accountId, UserUGCList listType, EUGCMatchingUGCType matchingUGCType, EUserUGCListSortOrder sortOrder, AppID creatorAppID, AppID consumerAppID, uint page)
        {
            CheckIfUsable();

            return new UGCQueryHandle(NativeMethods.UGC_CreateQueryUserUGCRequest(accountId.AsUInt32, (int)listType, (int)matchingUGCType, (int)sortOrder, creatorAppID.AsUInt32, creatorAppID.AsUInt32, page));
        }
Esempio n. 4
0
 public static void Encode(XdrDataOutputStream stream, AccountID encodedAccountID)
 {
     PublicKey.Encode(stream, encodedAccountID.InnerValue);
 }
Esempio n. 5
0
 public static void Encode(XdrDataOutputStream stream, LedgerKeyOffer encodedLedgerKeyOffer)
 {
     AccountID.Encode(stream, encodedLedgerKeyOffer.SellerID);
     Uint64.Encode(stream, encodedLedgerKeyOffer.OfferID);
 }
Esempio n. 6
0
 public OrderCancelRejectTransaction(TransactionID id, DateTime time, int userID, AccountID accountID, TransactionID batchID, RequestID requestID, TransactionType type, OrderID orderID, OrderID clientOrderID, TransactionRejectReason rejectReason)
 {
     this.Id            = id;
     this.Time          = time;
     this.UserID        = userID;
     this.AccountID     = accountID;
     this.BatchID       = batchID;
     this.RequestID     = requestID;
     this.Type          = type;
     this.OrderID       = orderID;
     this.ClientOrderID = clientOrderID;
     this.RejectReason  = rejectReason;
 }
Esempio n. 7
0
 public bool Equals(Account other)
 {
     return(AccountID.Equals(other.AccountID));
 }
Esempio n. 8
0
 internal TokenAssociateTransactionBody(Address token, AddressOrAlias account) : this()
 {
     Tokens.Add(new TokenID(token));
     Account = new AccountID(account);
 }
Esempio n. 9
0
        public void Setup()
        {
            //
            // observers

            SystemObserver.Setup(new IObserver<ISystemEvent>[] { new ConsoleObserver() });

            //
            // message handlers

            var handler = new CommandHandler();
            handler.WireToLambda<CreateAccount>(new CreateAccountHandler().Handle);
            handler.WireToLambda<AccountCreated>(new AccountCreatedHandler().Handle);

            //
            // message router

            var router = new MemoryMessageRouter();

            m_router = router;
            m_registerRoutes = router;

            m_registerRoutes.RegisterHandler<CreateAccount>(handler.Handle);
            m_registerRoutes.RegisterHandler<AccountCreated>(handler.Handle);

            //
            // message bus

            var bus = new MemoryBusWithRouter(m_router);

            //
            // Queue Writer

            var queueWriter = new QueueWriterToBus(bus);

            //
            // Misc

            m_sender = new MessageSender(new IQueueWriter[] { queueWriter });
            m_id = new AccountID(Guid.NewGuid());
        }
Esempio n. 10
0
        protected void lvACAccount_ItemCommand(object sender, ListViewCommandEventArgs e)
        {
            Int64 AccountID;

            Int64.TryParse(e.CommandArgument.ToString(), out AccountID);

            if (AccountID > 0)
            {
                if (string.Equals(e.CommandName, "EditItem"))
                {
                    _AccountID = AccountID;

                    PrepareEditView();

                    cpeEditor.Collapsed   = false;
                    cpeEditor.ClientState = "false";
                }
                else if (string.Equals(e.CommandName, "DeleteItem"))
                {
                    try
                    {
                        Int64 result = -1;

                        String fe = SqlExpressionBuilder.PrepareFilterExpression(ACAccountEntity.FLD_NAME_AccountID, AccountID.ToString(), SQLMatchType.Equal);

                        ACAccountEntity aCAccountEntity = new ACAccountEntity();


                        result = FCCACAccount.GetFacadeCreate().Delete(aCAccountEntity, fe, DatabaseOperationType.Delete, TransactionRequired.No);

                        if (result == 0)
                        {
                            _AccountID       = 0;
                            _ACAccountEntity = new ACAccountEntity();
                            PrepareInitialView();
                            BindACAccountList();

                            MiscUtil.ShowMessage(lblMessage, "A CAccount has been successfully deleted.", true);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to delete A CAccount.", true);
                        }
                    }
                    catch (Exception ex)
                    {
                        MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                    }
                }
            }
        }
Esempio n. 11
0
 internal static Address FromAccountID(AccountID accountId)
 {
     return(new Address(accountId.RealmNum, accountId.ShardNum, accountId.AccountNum));
 }
Esempio n. 12
0
 public void Setup()
 {
     m_strategy = new FileJsonDocumentStrategy();
     m_store = new FileDocumentStore(FOLDER_PATH, m_strategy);
     m_account = new AccountView
     {
         AccountID = Guid.NewGuid(),
         Name = "Test Account"
     };
     m_accountID = new AccountID(m_account.AccountID);
     m_store.ResetAll();
 }
 public TrailingStopLossOrderTransaction(TransactionID id, DateTime time, int userID, AccountID accountID, TransactionID batchID, RequestID requestID, TransactionType type, TradeID tradeID, ClientID clientTradeID, double distance, TimeInForce timeInForce, DateTime gTDTime, OrderTriggerCondition triggerCondition, TrailingStopLossOrderReason reason, ClientExtensions clientExtensions, TransactionID orderFillTransactionID, OrderID replacesOrderID, TransactionID cancellingTransactionID)
 {
     this.Id                      = id;
     this.Time                    = time;
     this.UserID                  = userID;
     this.AccountID               = accountID;
     this.BatchID                 = batchID;
     this.RequestID               = requestID;
     this.Type                    = type;
     this.TradeID                 = tradeID;
     this.ClientTradeID           = clientTradeID;
     this.Distance                = distance;
     this.TimeInForce             = timeInForce;
     this.GTDTime                 = gTDTime;
     this.TriggerCondition        = triggerCondition;
     this.Reason                  = reason;
     this.ClientExtensions        = clientExtensions;
     this.OrderFillTransactionID  = orderFillTransactionID;
     this.ReplacesOrderID         = replacesOrderID;
     this.CancellingTransactionID = cancellingTransactionID;
 }
Esempio n. 14
0
 public static void Encode(XdrDataOutputStream stream, SetOptionsOp encodedSetOptionsOp)
 {
     if (encodedSetOptionsOp.InflationDest != null)
     {
         stream.WriteInt(1);
         AccountID.Encode(stream, encodedSetOptionsOp.InflationDest);
     }
     else
     {
         stream.WriteInt(0);
     }
     if (encodedSetOptionsOp.ClearFlags != null)
     {
         stream.WriteInt(1);
         Uint32.Encode(stream, encodedSetOptionsOp.ClearFlags);
     }
     else
     {
         stream.WriteInt(0);
     }
     if (encodedSetOptionsOp.SetFlags != null)
     {
         stream.WriteInt(1);
         Uint32.Encode(stream, encodedSetOptionsOp.SetFlags);
     }
     else
     {
         stream.WriteInt(0);
     }
     if (encodedSetOptionsOp.MasterWeight != null)
     {
         stream.WriteInt(1);
         Uint32.Encode(stream, encodedSetOptionsOp.MasterWeight);
     }
     else
     {
         stream.WriteInt(0);
     }
     if (encodedSetOptionsOp.LowThreshold != null)
     {
         stream.WriteInt(1);
         Uint32.Encode(stream, encodedSetOptionsOp.LowThreshold);
     }
     else
     {
         stream.WriteInt(0);
     }
     if (encodedSetOptionsOp.MedThreshold != null)
     {
         stream.WriteInt(1);
         Uint32.Encode(stream, encodedSetOptionsOp.MedThreshold);
     }
     else
     {
         stream.WriteInt(0);
     }
     if (encodedSetOptionsOp.HighThreshold != null)
     {
         stream.WriteInt(1);
         Uint32.Encode(stream, encodedSetOptionsOp.HighThreshold);
     }
     else
     {
         stream.WriteInt(0);
     }
     if (encodedSetOptionsOp.HomeDomain != null)
     {
         stream.WriteInt(1);
         String32.Encode(stream, encodedSetOptionsOp.HomeDomain);
     }
     else
     {
         stream.WriteInt(0);
     }
     if (encodedSetOptionsOp.Signer != null)
     {
         stream.WriteInt(1);
         Signer.Encode(stream, encodedSetOptionsOp.Signer);
     }
     else
     {
         stream.WriteInt(0);
     }
 }
 public static void Encode(IByteWriter stream, AccountID  encodedAccountID) {
 PublicKey.Encode(stream, encodedAccountID.InnerValue);
 }
Esempio n. 16
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AccountCharacterTable"/> class.
 /// </summary>
 /// <param name="accountID">The initial value for the corresponding property.</param>
 /// <param name="characterID">The initial value for the corresponding property.</param>
 /// <param name="timeDeleted">The initial value for the corresponding property.</param>
 public AccountCharacterTable(AccountID @accountID, CharacterID @characterID, DateTime? @timeDeleted)
 {
     AccountID = @accountID;
     CharacterID = @characterID;
     TimeDeleted = @timeDeleted;
 }
 public static void Encode(XdrDataOutputStream stream, CreateAccountOp encodedCreateAccountOp)
 {
     AccountID.Encode(stream, encodedCreateAccountOp.Destination);
     Int64.Encode(stream, encodedCreateAccountOp.StartingBalance);
 }
Esempio n. 18
0
        /// <summary>
        /// Tries to get the AccountID for the account with the given name.
        /// </summary>
        /// <param name="accountName">The name of the account.</param>
        /// <param name="accountID">When the method returns true, contains the ID of the account with the given
        /// <paramref name="accountName"/>.</param>
        /// <returns>True if the <paramref name="accountID"/> was found; otherwise false.</returns>
        public bool TryGetAccountID(string accountName, out AccountID accountID)
        {
            var value = DbController.GetQuery<SelectAccountIDFromNameQuery>().Execute(accountName);

            if (!value.HasValue)
            {
                accountID = new AccountID(0);
                return false;
            }
            else
            {
                accountID = value.Value;
                return true;
            }
        }
 internal TokenRevokeKycTransactionBody(Address token, AddressOrAlias address) : this()
 {
     Token   = new TokenID(token);
     Account = new AccountID(address);
 }
 public static void Encode(IByteWriter stream, SimplePaymentResult encodedSimplePaymentResult)
 {
     AccountID.Encode(stream, encodedSimplePaymentResult.Destination);
     Asset.Encode(stream, encodedSimplePaymentResult.Asset);
     Int64.Encode(stream, encodedSimplePaymentResult.Amount);
 }
Esempio n. 21
0
 public override string ToString()
 {
     return($"{AccountID.Substring(0, Math.Min(10, AccountID.Length))}...");
 }
Esempio n. 22
0
 public override int GetHashCode()
 {
     return((Identity == null ? 0 : Identity.GetHashCode())
            ^ (IdentityID == null ? 0 : IdentityID.GetHashCode())
            ^ (AccountID == null ? 0 : AccountID.GetHashCode()));
 }
Esempio n. 23
0
 public static void Encode(IByteWriter stream, AccountID encodedAccountID)
 {
     PublicKey.Encode(stream, encodedAccountID.InnerValue);
 }
Esempio n. 24
0
 public static void Encode(XdrDataOutputStream stream, LedgerKeyTrustLine encodedLedgerKeyTrustLine)
 {
     AccountID.Encode(stream, encodedLedgerKeyTrustLine.AccountID);
     Asset.Encode(stream, encodedLedgerKeyTrustLine.Asset);
 }
        /// <summary>
        /// Executes the specified account ID.
        /// </summary>
        /// <param name="accountID">The ID of the account to ban.</param>
        /// <param name="length">The length of the ban.</param>
        /// <param name="reason">The reason for the ban.</param>
        /// <param name="issuedBy">The name of the person or system that issued the ban.</param>
        /// <returns>Number of rows affected by the query.</returns>
        /// <exception cref="DuplicateKeyException">Tried to perform an insert query for a key that already exists.</exception>
        public int ExecuteWithResult(AccountID accountID, TimeSpan length, string reason, string issuedBy)
        {
            var args = new QueryArgs(accountID, (int)length.TotalSeconds, reason, issuedBy);

            return(ExecuteWithResult(args));
        }
Esempio n. 26
0
 public static void Encode(XdrDataOutputStream stream, LedgerKeyData encodedLedgerKeyData)
 {
     AccountID.Encode(stream, encodedLedgerKeyData.AccountID);
     String64.Encode(stream, encodedLedgerKeyData.DataName);
 }
Esempio n. 27
0
 public static void Encode(IByteWriter stream, PaymentOp encodedPaymentOp)
 {
     AccountID.Encode(stream, encodedPaymentOp.Destination);
     Asset.Encode(stream, encodedPaymentOp.Asset);
     Int64.Encode(stream, encodedPaymentOp.Amount);
 }
Esempio n. 28
0
 public static void Encode(IByteWriter stream, CreateAccountOp encodedCreateAccountOp)
 {
     AccountID.Encode(stream, encodedCreateAccountOp.Destination);
     Int64.Encode(stream, encodedCreateAccountOp.StartingBalance);
 }
Esempio n. 29
0
 internal AccountAmount(Hashgraph.Address account, long amount) : this()
 {
     AccountID = new AccountID(account);
     Amount    = amount;
 }
Esempio n. 30
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AccountIpsTable"/> class.
 /// </summary>
 /// <param name="accountID">The initial value for the corresponding property.</param>
 /// <param name="iD">The initial value for the corresponding property.</param>
 /// <param name="ip">The initial value for the corresponding property.</param>
 /// <param name="time">The initial value for the corresponding property.</param>
 public AccountIpsTable(AccountID @accountID, UInt32 @iD, UInt32 @ip, DateTime @time)
 {
     AccountID = @accountID;
     ID = @iD;
     Ip = @ip;
     Time = @time;
 }
 public static void Encode(XdrDataOutputStream stream, SimplePaymentResult encodedSimplePaymentResult)
 {
     AccountID.Encode(stream, encodedSimplePaymentResult.Destination);
     Asset.Encode(stream, encodedSimplePaymentResult.Asset);
     Int64.Encode(stream, encodedSimplePaymentResult.Amount);
 }
 public static AccountID Decode(IByteReader stream) {
   AccountID decodedAccountID = new AccountID();
 decodedAccountID.InnerValue = PublicKey.Decode(stream);
   return decodedAccountID;
 }
Esempio n. 33
0
 public static void Encode(XdrDataOutputStream stream, InflationPayout encodedInflationPayout)
 {
     AccountID.Encode(stream, encodedInflationPayout.Destination);
     Int64.Encode(stream, encodedInflationPayout.Amount);
 }
Esempio n. 34
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AccountBanTable"/> class.
 /// </summary>
 /// <param name="accountID">The initial value for the corresponding property.</param>
 /// <param name="endTime">The initial value for the corresponding property.</param>
 /// <param name="expired">The initial value for the corresponding property.</param>
 /// <param name="iD">The initial value for the corresponding property.</param>
 /// <param name="issuedBy">The initial value for the corresponding property.</param>
 /// <param name="reason">The initial value for the corresponding property.</param>
 /// <param name="startTime">The initial value for the corresponding property.</param>
 public AccountBanTable(AccountID @accountID, DateTime @endTime, Boolean @expired, Int32 @iD, String @issuedBy,
                        String @reason, DateTime @startTime)
 {
     AccountID = @accountID;
     EndTime = @endTime;
     Expired = @expired;
     ID = @iD;
     IssuedBy = @issuedBy;
     Reason = @reason;
     StartTime = @startTime;
 }
 internal SecureString GetIV(string specified4B = "QC39")
 => ($"{ScreenName.Substring(0, 2)}{ScreenName.Substring(ScreenName.Length - 1 - 2, 2)}"
     + $"{AccountID.ToString().Substring(0, 3)}{AccountID.ToString().Substring(AccountID.ToString().Length - 1 - 3, 3)}"
     + $"{new string(specified4B.ToCharArray().Select(c => (char) (c >> 1)).ToArray())}"
     + @"Q#C_3*9"
     + $"{ProfileImageUrl.Substring(ProfileImageUrl.Length - 1 - 5, 5)}"
     + @"P!z2a@").ToSecureString();
Esempio n. 36
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AccountTable"/> class.
 /// </summary>
 /// <param name="creatorIp">The initial value for the corresponding property.</param>
 /// <param name="currentIp">The initial value for the corresponding property.</param>
 /// <param name="email">The initial value for the corresponding property.</param>
 /// <param name="iD">The initial value for the corresponding property.</param>
 /// <param name="name">The initial value for the corresponding property.</param>
 /// <param name="password">The initial value for the corresponding property.</param>
 /// <param name="permissions">The initial value for the corresponding property.</param>
 /// <param name="timeCreated">The initial value for the corresponding property.</param>
 /// <param name="timeLastLogin">The initial value for the corresponding property.</param>
 public AccountTable(UInt32 @creatorIp, uint? @currentIp, String @email, AccountID @iD, String @name, String @password,
                     UserPermissions @permissions, DateTime @timeCreated, DateTime @timeLastLogin)
 {
     CreatorIp = @creatorIp;
     CurrentIp = @currentIp;
     Email = @email;
     ID = @iD;
     Name = @name;
     Password = @password;
     Permissions = @permissions;
     TimeCreated = @timeCreated;
     TimeLastLogin = @timeLastLogin;
 }
Esempio n. 37
0
 public void SetLoginFile()
 {
     Loginfile = LocalDatManager.CreateNewFile(AccountID.ToString());
 }
Esempio n. 38
0
 public void Setup()
 {
     m_accountID = new AccountID(Guid.NewGuid());
     m_storageConfig = new FileRecordStorageConfig();
     m_factory = new FileRecordStorageFactory(m_storageConfig);
 }
 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.PauseEndorsement is null &&
         updateParameters.ConfiscateEndorsement is null &&
         updateParameters.SupplyEndorsement is null &&
         updateParameters.RoyaltiesEndorsement 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.PauseEndorsement is null))
     {
         PauseKey = new Key(updateParameters.PauseEndorsement);
     }
     if (!(updateParameters.ConfiscateEndorsement is null))
     {
         WipeKey = new Key(updateParameters.ConfiscateEndorsement);
     }
     if (!(updateParameters.SupplyEndorsement is null))
     {
         SupplyKey = new Key(updateParameters.SupplyEndorsement);
     }
     if (!(updateParameters.RoyaltiesEndorsement is null))
     {
         FeeScheduleKey = new Key(updateParameters.RoyaltiesEndorsement);
     }
     if (!(updateParameters.RenewAccount is null))
     {
         AutoRenewAccount = new AccountID(updateParameters.RenewAccount);
     }
 }