public QBitNinja.Client.Models.GetBlockResponse Result() { //UnityEngine.Debug.Log(UnityEngine.JsonUtility.ToJson(this,true)); var result = new QBitNinja.Client.Models.GetBlockResponse(); result.AdditionalInformation = BlockInformation.Create(additionalInformation); result.ExtendedInformation = extendedInformation.Length == 0?null:ExtendedBlockInformation.Create(UnityEngine.JsonUtility.FromJson <ExtendedBlockInformation>(extendedInformation)); result.Block = block.Length == 0?null:new NBitcoin.Block(NBitcoin.DataEncoders.Encoders.Hex.DecodeData(block)); return(result); }
static public QBitNinja.Client.Models.BlockInformation Create(BlockInformation block) { if (block == null || block.blockHeader == null) { return(null); } var blockInformation = new QBitNinja.Client.Models.BlockInformation(new BlockHeader(NBitcoin.DataEncoders.Encoders.Hex.DecodeData(block.blockHeader))); blockInformation.Height = block.height; blockInformation.Confirmations = block.confirmations; blockInformation.MedianTimePast = DateTimeOffset.Parse(block.medianTimePast); return(blockInformation); }
public QBitNinja.Client.Models.GetTransactionResponse Result() { //UnityEngine.Debug.Log(UnityEngine.JsonUtility.ToJson(this,true)); var result = new QBitNinja.Client.Models.GetTransactionResponse(); result.Transaction = new Transaction(NBitcoin.DataEncoders.Encoders.Hex.DecodeData(transaction)); result.TransactionId = uint256.Parse(transactionId); result.IsCoinbase = isCoinbase; result.Block = BlockInformation.Create(block); result.SpentCoins.AddRange(CoinJson.Create(spentCoins)); result.ReceivedCoins.AddRange(CoinJson.Create(receivedCoins)); result.FirstSeen = DateTimeOffset.Parse(firstSeen); result.Fees = fees; return(result); }