Exemple #1
0
        public static BlockAPIResult Create(Block block)
        {
            var result = new BlockAPIResult();

            result.SetBlock(block);
            result.ResultCode = APIResultCodes.Success;
            return(result);
        }
 public IEnumerable <Block> GetBlocks()
 {
     for (int i = 0; i < BlockDatas.Length; i++)
     {
         var block = new BlockAPIResult {
             BlockData = BlockDatas[i], ResultBlockType = ResultBlockTypes[i]
         };
         yield return(block.GetBlock());
     }
 }
Exemple #3
0
 public IEnumerable <T> GetBlocks <T>() where T : Block
 {
     for (int i = 0; i < BlockDatas?.Length; i++)
     {
         var block = new BlockAPIResult {
             BlockData = BlockDatas[i], ResultBlockType = ResultBlockTypes[i]
         };
         yield return((T)block.GetBlock());
     }
 }
Exemple #4
0
        async Task <BlockAPIResult> INodeAPI.GetTokenGenesisBlock(string AccountId, string TokenTicker, string Signature)
        {
            var request = new GetTokenGenesisBlockRequest()
            {
                AccountId   = AccountId,
                Signature   = Signature,
                TokenTicker = TokenTicker
            };
            var result = await GetTokenGenesisBlockAsync(request);

            var ret = new BlockAPIResult()
            {
                ResultBlockType = result.ResultBlockType,
                BlockData       = result.BlockData,
                ResultCode      = result.ResultCode
            };

            return(ret);
        }
Exemple #5
0
        async Task <BlockAPIResult> INodeAPI.GetLastServiceBlock(string AccountId, string Signature)
        {
            var reqGetLSB = new StandardWalletRequest()
            {
                AccountId = AccountId,
                Signature = Signature
            };

            var result = await GetLastServiceBlockAsync(reqGetLSB);

            var ret = new BlockAPIResult()
            {
                ResultBlockType = result.ResultBlockType,
                BlockData       = result.BlockData,
                ResultCode      = result.ResultCode
            };

            return(ret);
        }
Exemple #6
0
        async Task <BlockAPIResult> INodeAPI.GetBlockByIndex(string AccountId, long Index, string Signature)
        {
            var request = new GetBlockByIndexRequest()
            {
                AccountId = AccountId,
                Signature = Signature,
                Index     = Index
            };
            var result = await GetBlockByIndexAsync(request);

            var ret = new BlockAPIResult()
            {
                ResultBlockType = result.ResultBlockType,
                BlockData       = result.BlockData,
                ResultCode      = result.ResultCode
            };

            return(ret);
        }
Exemple #7
0
        async Task <BlockAPIResult> INodeAPI.GetBlockByHash(string AccountId, string Hash, string Signature)
        {
            var request = new GetBlockByHashRequest()
            {
                AccountId = AccountId,
                Signature = Signature,
                Hash      = Hash
            };
            var result = await GetBlockByHashAsync(request);

            var ret = new BlockAPIResult()
            {
                ResultBlockType = result.ResultBlockType,
                BlockData       = result.BlockData,
                ResultCode      = result.ResultCode
            };

            return(ret);
        }