获取合约详情
所有文档

          超级链BaaS平台

          获取合约详情

          获取合约详情

          接口描述 查询指定网络下的某合约详情。

          权限说明 请求发起人需要具有合法的AccessKeyID和SecretAccessKey才能发起请求。

          注意事项 如果请求中没有用户验证信息(即匿名访问),返回403 Forbidden,错误信息:AccessDenied

          请求(Request)

          • 请求语法

            GET /v1/ethereum/contract?networkUuid={NetworkUuid}&contractUuid={ContractUuid} HTTP/1.1
            Host: bbe.bj.baidubce.com
            x-bce-date: <x-bce-date>
            x-bce-request-id: <x-bce-request-id>
            Authorization: <Authorization>
          • 请求头域 除公共头域外,无其它特殊头域。
          • 请求参数

            名称 类型 描述 位置 是否必须
            networkUuid String 网络ID Query参数 必须
            contractUuid String 合约Uuid Query参数 必须

          响应(Response)

          • 响应头域 除公共头域外,无其它特殊头域。
          • 响应参数

            名称 类型 描述
            contractUuid String 合约Uuid
            networkUuid String 网络Uuid
            name String 合约名称
            description String 合约描述
            type String 合约类型,platform为平台基础库合约,user为用户自定义合约
            address String 合约地址
            abi String 合约abi
            sourceCode Object 合约源代码
            ownerAddress String 合约发布者地址
            status String 合约状态,包含None Deployed、Deployed、Deploying和Deployment Failed四种,分别为未部署、运行中,部署中,部署失败
            createdTime String 创建时间
            updatedTime String 更新时间

            失败响应参考错误码部分。

          示例

          • 请求示例
          GET /v1/ethereum/contract?contractUuid=aa16ff1a-9e66-42cd-9cd4-d196bbf7c14b&networkUuid=5c307678-99eb-9ff8-9626-c89c3f3d43e5 HTTP/1.1
          Host: bbe.bj.baidubce.com
          x-bce-date: 2019-10-29T07:12:40Z
          x-bce-request-id: b9485394-c7dc-3cfa-d454-57c34773d08c
          Authorization: bce-auth-v1/98cdcde27d8e464d895222fd8023a029/2019-10-29T07:12:40Z/1800/host/d9dbd7c7f901daf2c1aa7fd71f162f5783c57d07c3e8b896bbf64b7ed968bd9b
          • 响应示例
          200
          Content-Length: 2312
          Content-Type: application/json; charset=utf-8
          Date: Tue, 29 Oct 2019 07:14:27 GMT
          
          {
          	"data": {
          		"contractUuid": "aa16ff1a-9e66-42cd-9cd4-d196bbf7c14b",
          		"networkUuid": "5c307678-99eb-9ff8-9626-c89c3f3d43e5",
          		"name": "Simple",
          		"description": "",
          		"type": "user",
          		"address": "0xf9b94c4c4e2e1be7d3f8d8d043229ffe88a6e6ae",
          		"abi": "[{\"constant\":false,\"inputs\":[{\"name\":\"i\",\"type\":\"int64\"},{\"name\":\"s\",\"type\":\"string\"}],\"name\":\"set\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"name\":\"i\",\"type\":\"int64\"},{\"indexed\":true,\"name\":\"s\",\"type\":\"string\"},{\"indexed\":false,\"name\":\"h\",\"type\":\"bytes32\"},{\"indexed\":false,\"name\":\"m\",\"type\":\"string\"}],\"name\":\"ChangeEvent\",\"type\":\"event\"},{\"constant\":true,\"inputs\":[],\"name\":\"get\",\"outputs\":[{\"name\":\"i\",\"type\":\"int64\"},{\"name\":\"s\",\"type\":\"string\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"storedI\",\"outputs\":[{\"name\":\"\",\"type\":\"int64\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"storedS\",\"outputs\":[{\"name\":\"\",\"type\":\"string\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"}]",
          		"sourceCode": {
          			"browser/ballot_test.sol": "pragma solidity >=0.4.24;\n/**\n  * @title Simple Storage with events\n  * @dev Read and write values to the chain\n  */\ncontract Simple {\n  int64 public storedI;\n  string public storedS;\n\n  event ChangeEvent (\n    address indexed from,\n    int64 indexed i,\n    string indexed s,\n    bytes32 h,\n    string m\n  );\n\n\n  /**\n    * @dev Set the value\n    * @param i The new value integer\n    * @param s The new value string\n    */\n  function set(int64 i, string memory s) public {\n    storedI = i;\n    storedS = s;\n    emit ChangeEvent(msg.sender, i, s, keccak256(bytes(s)), s);\n  }\n\n  /**\n    * @dev Get the value\n    */\n  function get() public view returns (int64 i, string memory s) {\n    return (storedI, storedS);\n  }\n\n}"
          		},
          		"ownerAddress": "0xf3cfd0f15cbde02252b15e19c74397c771c89267",
          		"status": "Deployed",
          		"createdTime": "2019-10-29T15:10:41+08:00",
          		"updatedTime": "2019-10-29T15:10:41+08:00"
          	}
          }
          上一篇
          查询合约列表
          下一篇
          销毁合约