-
Notifications
You must be signed in to change notification settings - Fork 257
Oracle
[TOC]
请求报文:
{
"jsonrpc":"2.0",
"id": int32,
"method": "Chain33.CreateTransaction",
"params": [
{
"execer": "oracle",
"actionName": "EventPublish",
"payload": {
"type": "string",
"subType": "string",
"time": int64,
"content": "string",
"introduction": "string"
}
}
]
}
参数说明:
Chain33.CreateTransaction结构按通用要求填写: execer,执行器名称,这里固定为oralce actionName,操作名称,这里固定为EventPublish payload携带的内容格式如下:
参数 | 类型 | 说明 |
---|---|---|
type | string | 事件类型 |
subType | string | 事件子类型 |
time | int64 | 事件结果预计公布时间,UTC时间 |
content | string | 事件内容,例如可以用json格式表示 |
introduction | string | 事件介绍 |
响应报文
{
"id":int32,
"result":"string",
"error":null
}
参数说明:
参数 | 类型 | 说明 |
---|---|---|
result | string | 交易十六进制编码后的字符串 |
示例 Request:
{
"id": 0,
"method": "Chain33.CreateTransaction",
"params": [
{
"execer": "oracle",
"actionName": "EventPublish",
"payload": {
"type": "football",
"subType": "Premier League",
"time": 1548084600,
"content": "test",
"introduction": "test2"
}
}
]
}
Response:
{
"id": 0,
"result":"0a066f7261636c65123138010a2d1208666f6f7462616c6c1a0e5072656d696572204c656167756520fe",
"error": null
}
请求报文:
{
"id": int32,
"method": "Chain33.SignRawTx",
"params": [
{
"addr": "string",
"txHex": "string",
"expire": "string"
}
],
}
参数说明
参数 | 类型 | 是否必填 | 说明 |
---|---|---|---|
addr | string | 否 | addr与privkey可以只输入其一,如果使用addr则依赖钱包中存储的私钥签名 |
privkey | string | 否 | addr与privkey可以只输入其一,如果使用privkey则直接签名 |
txHex | string | 是 | 上一步生成的原始交易数据 |
expire | string | 是 | 过期时间可输入如"300s","-1.5h"或者"2h45m"的字符串,有效时间单位为"ns", "us" (or "µs"), "ms", "s", "m", "h" |
index | int32 | 否 | 若是签名交易组,则为要签名的交易序号,从1开始,小于等于0则为签名组内全部交易 |
token | string | 否 | |
fee | int64 | 是 | 费用 |
newToAddr | string | 否 |
响应报文
{
"id":int32,
"result":"string",
"error":null
}
参数说明
参数 | 类型 | 说明 |
---|---|---|
result | string | 交易签名后的十六进制字符串 |
请求报文:
{
"id":int32,
"method": "Chain33.SendTransaction",
"params": [{"data": "string"}]
}
参数说明
参数 | 类型 | 是否必填 | 说明 |
---|---|---|---|
data | string | 是 | 为上一步签名后的交易数据 |
token | string | 否 | 可为空 |
响应报文
{
"id":int32,
"result":"string",
"error":null
}
参数说明
参数 | 类型 | 说明 |
---|---|---|
result | string | 交易发送后,生成的交易哈希(后面可以使用此哈希查询交易状态和历史 |
请求报文
{
"id":int32,
"method": "Chain33.CreateTransaction",
"params": [
{
"execer": "oracle",
"actionName": "EventAbort",
"payload": {"eventID": "0x2edd12dee5724526d06517ce52704470b24b89dc918497d62c152dcfe8ddd5fd"}
}
]
}
参数说明
Chain33.CreateTransaction结构按通用要求填写: execer,执行器名称,这里固定为oralce actionName,操作名称,这里固定为EventAbort payload携带的内容格式如下:
参数 | 类型 | 说明 |
---|---|---|
eventID | string | 发布事件的事件ID |
响应报文
{
"id":int32,
"result":"string",
"error":null
}
参数说明
参数 | 类型 | 说明 |
---|---|---|
result | string | 交易十六进制编码后的字符串 |
请求报文:
{
"id":int32,
"method": "Chain33.CreateTransaction",
"params": [
{
"execer": "oracle",
"actionName": "ResultPrePublish",
"payload": {
"eventID": "0xfa3e8d786df3085e71bcff1615847d2f353c45545724c785a9729db1c6106b13",
"source": "............",
"result": "0:0"
}
}
]
}
参数说明
Chain33.CreateTransaction结构按通用要求填写: execer,执行器名称,这里固定为oralce actionName,操作名称,这里固定为ResultPrePublish payload携带的内容格式如下:
参数 | 类型 | 说明 |
---|---|---|
eventID | string | 发布事件的事件ID |
source | string | 发布结果的源,比如XX体育 |
result | string | 发布的事件结果,比如比赛比分 |
响应报文
{
"id":int32,
"result":"string",
"error":null
}
参数说明
参数 | 类型 | 说明 |
---|---|---|
result | string | 交易十六进制编码后的字符串 |
请求报文
{
"id":int32,
"method": "Chain33.CreateTransaction",
"params": [
{
"execer": "oracle",
"actionName": "ResultAbort",
"payload": {
"eventID": "0x1c3dc77998a4efa1b3b3bd527b83714da8c6b668d26002f06de6144277cb6ddd"
}
}
]
}
参数说明
Chain33.CreateTransaction结构按通用要求填写: execer,执行器名称,这里固定为oralce actionName,操作名称,这里固定为ResultAbort payload携带的内容格式如下:
参数 | 类型 | 说明 |
---|---|---|
eventID | string | 发布事件的事件ID |
响应报文
{
"id":int32,
"result":"string",
"error":null
}
参数说明
参数 | 类型 | 说明 |
---|---|---|
result | string | 交易十六进制编码后的字符串 |
请求报文
{
"id":int32,
"method": "Chain33.CreateTransaction",
"params": [
{
"execer": "oracle",
"actionName": "ResultPublish",
"payload": {
"eventID": "0xd0181ccc942c72d1a2d1bd10c520751fc743693c8131e59119063b324fa96796",
"source": "............",
"result": "1:1"
}
}
]
}
参数说明
Chain33.CreateTransaction结构按通用要求填写: execer,执行器名称,这里固定为oralce actionName,操作名称,这里固定为ResultPublish payload携带的内容格式如下:
参数 | 类型 | 说明 |
---|---|---|
eventID | string | 发布事件的事件ID |
source | string | 发布结果的源,比如XX体育 |
result | string | 发布的事件结果,比如比赛比分 |
响应报文
{
"id":int32,
"result":"string",
"error":null
}
参数说明
参数 | 类型 | 说明 |
---|---|---|
result | string | 交易十六进制编码后的字符串 |
请求报文
{
"id":int32,
"method": "Chain33.Query",
"params": [
{
"execer": "oracle",
"funcName": "QueryOraclesByIDs",
"payload": {
"eventID": ["0xd0181ccc942c72d1a2d1bd10c520751fc743693c8131e59119063b324fa96796"]
}
}
]
}
参数说明
Chain33.Query结构按通用要求填写: execer,执行器名称,这里固定为oracle funcName,操作名称,这里固定为QueryOraclesByIDs payload携带的内容格式如下:
参数 | 类型 | 说明 |
---|---|---|
eventID | []string | 需要查询信息的事件ID数组 |
响应报文
{
"id":int32,
"result": {
"status": [
{
"eventID": "0xd0181ccc942c72d1a2d1bd10c520751fc743693c8131e59119063b324fa96796",
"addr": "14KEKbYtKKQm4wMthSK9J4La4nAiidGozt",
"type": "football",
"subType": "Premier League",
"time": "1548084600",
"content": "test007",
"introduction": "test007-intr",
"status": {
"opAddr": "14KEKbYtKKQm4wMthSK9J4La4nAiidGozt",
"status": 5
},
"source": "............",
"result": "1:1",
"preStatus": {
"opAddr": "14KEKbYtKKQm4wMthSK9J4La4nAiidGozt",
"status": 3
}
}
]
},
"error": null
}
参数说明
参数 | 类型 | 说明 |
---|---|---|
status.eventID | string | 事件ID |
status.addr | string | 事件的地址 |
status.type | string | 事件的类型 |
status.subType | string | 发布事件的子类型 |
status.time | int64 | 事件结果预计公布时间,UTC时间 |
status.content | string | 事件内容,例如可以用json格式表示 |
status.introduction | string | 事件介绍 |
status.status | json | 当前状态,包括操作者地址,当前状态值;0:初始状态,1:事件已发布,2:事件已取消,3:事件结果已预发布,4:事件预发布的结果已取消,5:事件结果已发布 |
status.source | string | 发布结果的源,比如XX体育 |
status.result | string | 发布事件的结果,比如比赛比分 |
status.preStatus | json | 前一个状态,包括操作者地址,当前状态值 |
请求报文
{
"id":int32,
"method": "Chain33.Query",
"params": [
{
"execer": "oracle",
"funcName": "QueryEventIDsByStatus",
"payload": {
"status": 4,
"addr": "",
"type": "",
"eventID": ""
}
}
]
}
参数说明
Chain33.Query结构按通用要求填写: execer,执行器名称,这里固定为oracle funcName,操作名称,这里固定为QueryEventIDsByStatus payload携带的内容格式如下:
参数 | 类型 | 是否必填 | 说明 |
---|---|---|---|
status | int32 | 是 | 事件所处状态值 |
addr | string | 不填 | 创建事件的地址 |
type | string | 不填 | 事件的类型 |
eventID | string | 视情况 | 事件ID,第一次查询为空,如果得到结果数量超过一页,将eventID设置为上次查询结果的最后一个id,从而查到下一页的数据 |
响应报文
{
"id":int32,
"result": {
"eventID": [
"0x45aca020ca26b2e0f92590c0662978194221a6b791a97e748f599221df3f2786",
"0x437d5ca35bbc78a8bdf72978c018270883a923fce38664be0de1e6dc569e277f"
]
},
"error": null
}
参数说明
参数 | 类型 | 说明 |
---|---|---|
eventID | []string | 符合条件的事件ID数组 |
请求报文
{
"id":int32,
"method": "Chain33.Query",
"params": [
{
"execer": "oracle",
"funcName": "QueryEventIDsByAddrAndStatus",
"payload": {
"status": 2,
"addr": "14KEKbYtKKQm4wMthSK9J4La4nAiidGozt",
"type": "",
"eventID": ""
}
}
]
}
参数说明
Chain33.Query结构按通用要求填写: execer,执行器名称,这里固定为oracle funcName,操作名称,这里固定为QueryEventIDsByAddrAndStatus payload携带的内容格式如下:
参数 | 类型 | 是否必填 | 说明 |
---|---|---|---|
status | int32 | 是 | 事件所处状态值 |
addr | string | 是 | 创建事件的地址 |
type | string | 不填 | 事件的类型 |
eventID | string | 视情况 | 事件ID,第一次查询为空,如果得到结果数量超过一页,将eventID设置为上次查询结果的最后一个id,从而查到下一页的数据 |
响应报文
{
"id":int32,
"result": {
"eventID": [
"0xdd6b4ebfb7560e803cc4500490d2b7e6818296eed19d938446f2230eaa04a5e1",
"0x1aae4290800019f6ba97ac45acba334aa919faff1a37c4adffce5eb12c6d3a06"
]
},
"error": null
}
参数说明
参数 | 类型 | 说明 |
---|---|---|
eventID | []string | 符合条件的事件ID数组 |
请求报文
{
"id":int32,
"method": "Chain33.Query",
"params": [
{
"execer": "oracle",
"funcName": "QueryEventIDsByTypeAndStatus",
"payload": {
"status": 1,
"addr": "",
"type": "football",
"eventID": ""
}
}
]
}
参数说明
Chain33.Query结构按通用要求填写: execer,执行器名称,这里固定为oracle funcName,操作名称,这里固定为QueryEventIDsByTypeAndStatus payload携带的内容格式如下:
参数 | 类型 | 是否必填 | 说明 |
---|---|---|---|
status | int32 | 是 | 事件所处状态值 |
addr | string | 不填 | 创建事件的地址 |
type | string | 是 | 事件的类型 |
eventID | string | 视情况 | 事件ID,第一次查询为空,如果得到结果数量超过一页,将eventID设置为上次查询结果的最后一个id,从而查到下一页的数据 |
响应报文
{
"id":int32,
"result": {
"eventID": [
"0xdd6b4ebfb7560e803cc4500490d2b7e6818296eed19d938446f2230eaa04a5e1",
"0x1aae4290800019f6ba97ac45acba334aa919faff1a37c4adffce5eb12c6d3a06"
]
},
"error": null
}
参数说明
参数 | 类型 | 说明 |
---|---|---|
eventID | []string | 符合条件的事件ID数组 |
hello world