Пример #1
0
        public async Task <ValidateAccountResult> ValidateAccountAsync(RaiAddress acc)
        {
            var action  = new ValidateAccount(acc);
            var handler = new ActionHandler <ValidateAccount, ValidateAccountResult>(_node);

            return(await handler.Handle(action));
        }
Пример #2
0
        /// <summary>
        /// Get account number for the public key
        /// </summary>>
        public async Task <GetAccountByPublicKeyResult> GetAccountByPublicKeyAsync(string key)
        {
            var action  = new GetAccountByPublicKey(key);
            var handler = new ActionHandler <GetAccountByPublicKey, GetAccountByPublicKeyResult>(_node);

            return(await handler.Handle(action));
        }
Пример #3
0
        /// <summary>
        /// Returns how many RAW is owned and how many have not yet been received by account.
        /// </summary>
        /// <param name="acc">The account to get balance for.</param>
        /// <returns>Balance of <paramref name="acc"/> in RAW.</returns>
        public async Task <BalanceResult> GetBalanceAsync(RaiAddress acc)
        {
            var action  = new GetBalance(acc);
            var handler = new ActionHandler <GetBalance, BalanceResult>(_node);

            return(await handler.Handle(action));
        }
Пример #4
0
        /// <summary>
        /// enable_control required
        /// Send amount from source in wallet to destination
        /// </summary>
        /// <param name="wallet">Wallet</param>
        /// <param name="source">Source</param>create
        /// <param name="destination">Destination</param>
        /// <param name="amount">Amount in RAW.</param>
        /// <returns></returns>
        public async Task <SendResult> SendAsync(string wallet, RaiAddress source, RaiAddress destination, RaiUnits.RaiRaw amount)
        {
            var action  = new Send(wallet, source, destination, amount);
            var handler = new ActionHandler <Send, SendResult>(_node);

            return(await handler.Handle(action));
        }
Пример #5
0
        public async Task <BalancesResult> GetBalancesAsync(IEnumerable <RaiAddress> acc)
        {
            var action  = new GetBalances(acc);
            var handler = new ActionHandler <GetBalances, BalancesResult>(_node);

            return(await handler.Handle(action));
        }
Пример #6
0
        /// <summary>
        /// Get number of blocks for a specific account
        /// </summary>
        /// <param name="acc">The account to get block count for.</param>
        /// <returns>Number of blocks on account.</returns>
        public async Task <AccountBlockCountResult> GetAccountBlockCountAsync(RaiAddress acc)
        {
            var action  = new GetAccountBlockCount(acc);
            var handler = new ActionHandler <GetAccountBlockCount, AccountBlockCountResult>(_node);

            return(await handler.Handle(action));
        }
Пример #7
0
        /// <summary>
        /// Reports send/receive information for a account
        /// </summary>>
        public async Task <AccountHistoryResult> GetAccountHistoryAsync(RaiAddress acc, int count = 1)
        {
            var action  = new GetAccountHistory(acc, count);
            var handler = new ActionHandler <GetAccountHistory, AccountHistoryResult>(_node);

            return(await handler.Handle(action));
        }
Пример #8
0
        /// <summary>
        /// Returns frontier, open block, change representative block, balance, last modified timestamp from local database & block count for account
        /// </summary>
        public async Task <AccountInformationResult> GetAccountInformationAsync(RaiAddress acc, bool representative = false, bool weight = false, bool pending = false)
        {
            var action  = new GetAccountInformation(acc, representative, weight, pending);
            var handler = new ActionHandler <GetAccountInformation, AccountInformationResult>(_node);

            return(await handler.Handle(action));
        }
Пример #9
0
        /// <summary>
        /// Returns frontier, open block, change representative block, balance, last modified timestamp from local database & block count for account
        /// </summary>
        public async Task <AccountInformationResult> GetAccountInformationAsync(RaiAddress acc)
        {
            var action  = new GetAccountInformation(acc);
            var handler = new ActionHandler <GetAccountInformation, AccountInformationResult>(_node);

            return(await handler.Handle(action));
        }
Пример #10
0
        /// <summary>
        /// enable_control required
        // Creates a new account, insert next deterministic key in wallet
        public async Task <CreateAccountResult> CreateAccountAsync(string wallet)
        {
            var action  = new CreateAccount(wallet);
            var handler = new ActionHandler <CreateAccount, CreateAccountResult>(_node);

            return(await handler.Handle(action));
        }
Пример #11
0
        public async Task <WorkGenerateResult> GetWorkAsync(string hash)
        {
            var action  = new WorkGenerate(hash);
            var handler = new ActionHandler <WorkGenerate, WorkGenerateResult>(_node);

            return(await handler.Handle(action));
        }
Пример #12
0
        public async Task <ProcessBlockResult> ProcessBlockAsync(string block)
        {
            var action  = new ProcessBlock(block);
            var handler = new ActionHandler <ProcessBlock, ProcessBlockResult>(_node);

            return(await handler.Handle(action));
        }
Пример #13
0
        private async Task <TResult> Handle <TAction, TResult>(IAction <TResult> action)
            where TAction : class, IAction <TResult>
            where TResult : class, IActionResult
        {
            var handler = new ActionHandler <TAction, TResult>(_node);

            return(await handler.Handle(action));
        }
Пример #14
0
        public async Task <BlockAccountResult> GetBlockAccountAsync(string hash)
        {
            var action = new BlockAccount
            {
                Hash = hash
            };
            var handler = new ActionHandler <BlockAccount, BlockAccountResult>(_node);

            return(await handler.Handle(action));
        }
Пример #15
0
        /// <summary>
        /// Return block by hash.
        /// </summary>
        /// <param name="hash">Block hash.</param>
        /// <returns>Block info.</returns>
        public async Task <RetrieveBlockResult> GetRetrieveBlockAsync(string hash)
        {
            var action = new Actions.RetrieveBlock
            {
                Hash = hash
            };
            var handler = new ActionHandler <Actions.RetrieveBlock, RetrieveBlockResult>(_node);

            return(await handler.Handle(action));
        }
Пример #16
0
        /// <summary>
        /// Get account key
        /// </summary>
        /// <param name="account">Account</param>
        /// <returns>Ket <see cref="AccountKeyResult"/></returns>
        public async Task <AccountKeyResult> GetAccountKeyAsync(RaiAddress account)
        {
            var action = new AccountKey
            {
                AccountNumber = account,
            };

            var handler = new ActionHandler <AccountKey, AccountKeyResult>(_node);

            return(await handler.Handle(action));
        }
Пример #17
0
        /// <summary>
        /// Returns a consecutive list of block hashes in the account chain starting at block up to count.
        /// Will list all blocks back to the open block of this chain when count is set to "-1".
        /// The requested block hash is included in the answer.
        /// </summary>
        /// <param name="block">Block hash</param>
        /// <param name="count">Block count</param>
        /// <returns>Chain <see cref="GetChainResult"/></returns>
        public async Task <GetChainResult> GetChainAsync(string block, long count = -1)
        {
            var action = new GetChain
            {
                Block = block,
                Count = count
            };
            var handler = new ActionHandler <GetChain, GetChainResult>(_node);

            return(await handler.Handle(action));
        }
Пример #18
0
        /// <summary>
        /// Returns a list of block hashes which have not yet been received by these accounts
        /// </summary>
        /// <param name="accounts">List of accounts</param>
        /// <param name="count">Count</param>
        /// <param name="source">Is need return a list of pending block hashes with amount and source accounts</param>
        /// <returns>List of block hashes which have not yet been received by these accounts <see cref="AccountsPendingResult"/></returns>
        public async Task <AccountsPendingResult> GetAccountsPendingAsync(List <string> accounts, long count = -1, bool source = true)
        {
            var action = new AccountsPending
            {
                Accounts = accounts,
                Source   = source,
                Count    = count,
            };
            var handler = new ActionHandler <AccountsPending, AccountsPendingResult>(_node);

            return(await handler.Handle(action));
        }
Пример #19
0
        /// <summary>
        /// Get blocks info
        /// </summary>
        /// <param name="hashes">Blocks hashes.</param>
        /// <param name="pending">Include panding info</param>
        /// <param name="source">Include source info</param>
        /// <param name="balance">Include balance info</param>
        /// <returns>Block info.</returns>
        public async Task <RetrieveBlocksInfoResult> GetRetrieveBlocksInfoAsync(List <string> hashes,
                                                                                bool pending = false,
                                                                                bool source  = false, bool balance = false)
        {
            var action = new RetrieveBlocksInfo
            {
                Hashes  = hashes,
                Balance = balance,
                Pending = pending,
                Source  = source
            };
            var handler = new ActionHandler <RetrieveBlocksInfo, RetrieveBlocksInfoResult>(_node);

            return(await handler.Handle(action));
        }
Пример #20
0
        public async Task <BlockCreateResult> BlockCreateSendAsync(string wallet, RaiAddress account, RaiAddress destination, RaiUnits.RaiRaw balance, RaiUnits.RaiRaw amount, string previous)
        {
            var action = new BlockCreate {
                Type          = BlockType.send,
                Wallet        = wallet,
                AccountNumber = account,
                Destination   = destination,
                Balance       = balance,
                Amount        = amount,
                Previous      = previous
            };
            var handler = new ActionHandler <BlockCreate, BlockCreateResult>(_node);

            return(await handler.Handle(action));
        }