public ActionResult <TransactionInfo> GetContractFromTransaction(RequestGetterApiModel model) { InitAuthKey(model); SmartSourceCode ret; TransactionInfo res; try { ret = new SmartSourceCode(); res = ServiceProvider.GetService <MonitorService>().GetTransaction(model); if (res.Bundle != null && res.Bundle.Contract.Deploy != null) { ret.SourceString = res.Bundle.Contract.Deploy.SourceCode; if (model.Compressed) { ret.gZipped = Utils.Compress(res.Bundle.Contract.Deploy.SourceCode); } } ret.Success = true; } catch (Exception ex) { ret = new SmartSourceCode(); ret.Success = false; ret.Message = ex.Message; } return(Ok(ret)); }
public ActionResult <ResponseApiModel> GetContractByAddress(RequestKeyApiModel model) { InitAuthKey(model); SmartSourceCode res; try { res = ServiceProvider.GetService <MonitorService>().GetContractByAddress(model); if (res.SourceString != null /* && model.CompressString*/) { if (model.Compressed) { res.gZipped = Utils.Compress(res.SourceString); } res.SourceString = res.SourceString; } res.Success = true; } catch (Exception ex) { res = new SmartSourceCode(); res.Success = false; res.Message = ex.Message; } return(Ok(res)); }
public SmartSourceCode GetContractByAddress(RequestKeyApiModel model) { var response = new SmartSourceCode(); using (var client = GetClientByModel(model)) { var publicKeyByte = SimpleBase.Base58.Bitcoin.Decode(model.PublicKey); var result = client.SmartContractGet(publicKeyByte.ToArray()); if (result.SmartContract != null && result.SmartContract.SmartContractDeploy != null) { response.SourceString = result.SmartContract.SmartContractDeploy.SourceCode; } } return(response); }