Exemple #1
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));
        }
Exemple #2
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));
        }
Exemple #3
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));
        }
Exemple #4
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));
        }
Exemple #5
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));
        }
Exemple #6
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));
        }
Exemple #7
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));
        }