コード例 #1
0
        static ICoin Create(CoinJson coin)
        {
            var transactionId = uint256.Parse(coin.transactionId);
            var scriptPubKey  = new Script(NBitcoin.DataEncoders.Encoders.Hex.DecodeData(coin.scriptPubKey));
            var redeemScript  = coin.redeemScript.Length == 0 ? null: new Script(NBitcoin.DataEncoders.Encoders.Hex.DecodeData(coin.redeemScript));
            var iCoin         = redeemScript == null ?
                                new Coin(new OutPoint(transactionId, coin.index), new TxOut(coin.value, scriptPubKey)) :
                                new ScriptCoin(new OutPoint(transactionId, coin.index), new TxOut(coin.value, scriptPubKey), redeemScript);

            return(iCoin);
        }
コード例 #2
0
        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);
        }
コード例 #3
0
        static public QBitNinja.Client.Models.BalanceOperation[] Create(BalanceOperation[] balanceOperations)
        {
            var result = new QBitNinja.Client.Models.BalanceOperation[balanceOperations.Length];

            for (int i = 0; i < balanceOperations.Length; i++)
            {
                result[i] = new QBitNinja.Client.Models.BalanceOperation();

                result[i].Amount        = balanceOperations[i].amount;
                result[i].Confirmations = balanceOperations[i].confirmations;
                result[i].Height        = balanceOperations[i].height;
                result[i].BlockId       = balanceOperations[i].blockId.Length == 0?null:uint256.Parse(balanceOperations[i].blockId);
                result[i].TransactionId = uint256.Parse(balanceOperations[i].transactionId);
                result[i].ReceivedCoins = new System.Collections.Generic.List <ICoin>(CoinJson.Create(balanceOperations[i].receivedCoins));
                result[i].SpentCoins    = new System.Collections.Generic.List <ICoin>(CoinJson.Create(balanceOperations[i].spentCoins));
                result[i].FirstSeen     = DateTimeOffset.Parse(balanceOperations[i].firstSeen);;
            }

            return(result);
        }