Skip to content

API Doc

HuiFeng Tang edited this page Dec 28, 2021 · 11 revisions

Tai Shang World Generator

API

/tai_shang_world_generator/api/v1/gen_map

接口定义:生成随机地图数据

标题 描述
接口路径 /tai_shang_world_generator/api/v1/gen_map
Method POST
Content-Type application/json

Query Params:

Key Type Value Required
source string a_block Y

Post表单参数:

Key Type Value Required
block_number int Y
rule string RuleA Y

例如:

POST http://124.251.110.212:4001/tai_shang_world_generator/api/v1/gen_map?source=a_block

传入数据:

{
    "block_number": 22793130,
    "rule": "RuleA"
}

返回内容:

{
    "error_code": 0,
    "error_msg": "success",
    "result": {
        "map": [
            [
                1,
                0,
                2,
                2,
                0,
                0,
                2,
                1,
                0,
                0,
                0,
                0,
                2,
                0,
                2,
                0,
                0,
                1,
                1,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                1
            ],
            ...
            ]
        ],
        "type": "ice"
    }
}

/tai_shang_world_generator/api/v1/mint

接口定义:生成随机地图数据

标题 描述
接口路径 /tai_shang_world_generator/api/v1/mint
Method POST
Content-Type application/json

Query Params:

Key Type Value Required
coupon_id string afbf78b685e82cb7385922d5ccd1a841 Y

Post表单参数:

Key Type Value Required
block_number int Y
rule string RuleA Y
source string a_block Y

例如:

POST http://localhost:4000/tai_shang_world_generator/api/v1/mint?coupon_id=afbf78b685e82cb7385922d5ccd1a841

传入参数

{
    "block_number": 22793130,
    "rule": "RuleA",
    "source": "a_block"
}

返回内容:

{
    "error_code": 0,
    "error_msg": "success",
    "result": {
        "token_info": {
            "contract_addr": "0x01",
            "minter_name": "leeduckgo",
            "token_id": 1,
            "tx_id": "0x0"
        }
    }
}

/tai_shang_world_generator/api/v1/get_last_block_num

接口定义:获取块高

标题 描述
接口路径 /tai_shang_world_generator/api/v1/get_last_block_num
Method GET
Content-Type application/json

例如:

GET http://124.251.110.212:4001/tai_shang_world_generator/api/v1/get_last_block_num

返回内容:

{
  "error_code": 0,
  "error_msg": "success",
  "result": {
    "last_block_num": 23066865
  }
}
Clone this wiki locally