Skip to content

API Doc

HuiFeng Tang edited this page Feb 5, 2022 · 11 revisions

Tai Shang World Generator

API

/tai_shang_world_generator/api/v1/load_character?chain_name=Moonbeam&contract_addr=0xabc&token_id=1

// TODO

接口定义:加载NFT为游戏角色

返回值:

{
"error_code": 0,
"error_msg": "success",
"result": {
"character_info": {
"badges": [
"noncegeeker",
"artist"
],
"elements": {
"fifth": 1,
"first": 1,
"fourth": 1,
"second": 1,
"sixth": 1,
"third": 1
}
}
}
}

/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": {
        "ele_description": {
            "object": [
                31,
                40
            ],
            "sprite": [
                41,
                55
            ],
            "unwalkable": [
                1
            ],
            "walkable": [
                0
            ]
        },
        "map": [
            [
                1,
                0,
                48,
                40,
                0,
                0,
                38,
                1,
                0,
                0,
                0,
                0,
                40,
                0,
                44,
                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",
    "description": "balabala..."
}

返回内容:

{
    "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 https://map.noncegeek.com/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