Ejemplo n.º 1
0
        /// TODO this should return a schema object
        /// <inheritdoc />
        public virtual async Task <string> LookupSchemaAsync(IAgentContext agentContext, int sequenceId)
        {
            var result = await LedgerService.LookupTransactionAsync(agentContext, null, sequenceId);

            if (!string.IsNullOrEmpty(result))
            {
                try
                {
                    var txnData = JObject.Parse(result)["result"]["data"]["txn"]["data"]["data"] as JObject;
                    var txnId   = JObject.Parse(result)["result"]["data"]["txnMetadata"]["txnId"].ToString();

                    int seperator = txnId.LastIndexOf(':');

                    string ver = txnId.Substring(seperator + 1, txnId.Length - seperator - 1);

                    txnData.Add("id", txnId);
                    txnData.Add("ver", ver);
                    txnData.Add("seqNo", sequenceId);

                    return(txnData.ToString());
                }
                catch (Exception) { }
            }

            return(null);
        }