public static void handleTxItem(int blockindex, DateTime blockTime, MyJson.JsonNode_Object txItem) { var vout_tx = txItem["vout"].AsList(); if (vout_tx.Count > 0) { foreach (MyJson.JsonNode_Object voutitem in vout_tx) { var assetID = voutitem["asset"].AsString(); if (!Mongo.isDataExist(Collection, "id", assetID)) { lock (lockObj) { if (!Mongo.isDataExist(Collection, "id", assetID)) { var resasset = Rpc.getassetstate(Config.NeoCliJsonRPCUrl, assetID.Replace("0x", "")).Result; if (resasset != null) { Collection.InsertOne(BsonDocument.Parse(resasset.ToString())); } } } } } } }
public static void handle(MyJson.JsonNode_Object notification) { string assetId = notification["contract"].AsString(); //var findBsonNEP5AssetBson = BsonDocument.Parse("{assetid:'" + assetId + "'}"); //var queryNEP5AssetBson = Collection.Find(findBsonNEP5AssetBson).ToList(); if (!Mongo.isDataExist(Collection, "assetid", assetId)) { lock (lockObj) { if (!Mongo.isDataExist(Collection, "assetid", assetId)) { NEP5.Asset asset = new NEP5.Asset(Config.NeoCliJsonRPCUrl, assetId); Collection.InsertOne(asset); } } } }