241 lines
9.2 KiB
Python
241 lines
9.2 KiB
Python
# -*- coding: utf-8 -*-
|
||
|
||
import _common
|
||
|
||
class Market(object):
|
||
|
||
def __init__(self):
|
||
self.internalApis = [
|
||
{
|
||
'name': 'tokenAuth',
|
||
'desc': 'tokenAuth',
|
||
'group': 'Market',
|
||
'url': 'webapp/index.php?c=Market&a=tokenAuth',
|
||
'params': [
|
||
['account', '', '钱包账号'],
|
||
['token', '', 'token'],
|
||
['net_id', '', '网络id'],
|
||
],
|
||
'response': [
|
||
_common.RspHead(),
|
||
['account', '', 'account'],
|
||
]
|
||
},
|
||
]
|
||
self.apis = [
|
||
{
|
||
'name': 'getNonce',
|
||
'desc': '获取登录认证nonce',
|
||
'group': 'Market',
|
||
'url': 'webapp/index.php?c=Market&a=getNonce',
|
||
'params': [
|
||
['account', '', '钱包账号'],
|
||
['token', '', 'token'],
|
||
['net_id', '', '网络id'],
|
||
],
|
||
'response': [
|
||
_common.RspHead(),
|
||
['state', 0, '0:token无效客户端需签名 1:token是有效的客户端不需要再次签名'],
|
||
['nonce', '', 'nonce'],
|
||
]
|
||
},
|
||
{
|
||
'name': 'auth',
|
||
'desc': '认证',
|
||
'group': 'Market',
|
||
'url': 'webapp/index.php?c=Market&a=auth',
|
||
'params': [
|
||
['account', '', '钱包账号'],
|
||
['tips', '', 'tips'],
|
||
['nonce', '', 'nonce'],
|
||
['signature', '', '签名'],
|
||
['net_id', '', '网络id'],
|
||
],
|
||
'response': [
|
||
_common.RspHead(),
|
||
['token', '', 'token'],
|
||
]
|
||
},
|
||
{
|
||
'name': 'getPreSaleInfo',
|
||
'desc': '获取预售信息',
|
||
'group': 'Market',
|
||
'url': 'webapp/index.php?c=Market&a=getPreSaleInfo',
|
||
'params': [
|
||
['account', '', '钱包账号'],
|
||
],
|
||
'response': [
|
||
_common.RspHead(),
|
||
['presale_info', _common.PreSaleInfo(), '预售信息'],
|
||
]
|
||
},
|
||
{
|
||
'name': 'searchBox',
|
||
'desc': '获取预售商品信息',
|
||
'group': 'Market',
|
||
'url': 'webapp/index.php?c=Market&a=searchBox',
|
||
'params': [
|
||
['account', 0, '钱包账号'],
|
||
['page', 0, '获取第几页数据'],
|
||
['sort', '', '排序字段'],
|
||
],
|
||
'response': [
|
||
_common.RspHead(),
|
||
['!rows', [_common.PreSaleBox()], '商品信息'],
|
||
['page', _common.Page(), '分页信息'],
|
||
]
|
||
},
|
||
{
|
||
'name': 'buyBox',
|
||
'desc': '购买箱子',
|
||
'group': 'Market',
|
||
'url': 'webapp/index.php?c=Market&a=buyBox',
|
||
'params': [
|
||
['token', '', 'token'],
|
||
['type', '', '注意是箱子id!!!(box_id)'],
|
||
['buyer_address', '', '购买者账号id'],
|
||
['price', '', 'price'],
|
||
['payment_token_address', '', 'payment_token_address'],
|
||
['nonce', '', 'nonce'],
|
||
['signature', '', '签名soliditySha3(type, payment_token_address, price, nonce), 签名的replace客户端做处理'],
|
||
['net_id', '', '网络id'],
|
||
],
|
||
'response': [
|
||
_common.RspHead(),
|
||
['order_id', '', '订单号(errcode = 0的时候,根据订单号客户端定时调用queryOrder接口)查询状态'],
|
||
]
|
||
},
|
||
{
|
||
'name': 'openLuckyBox',
|
||
'desc': '开宝箱',
|
||
'group': 'Market',
|
||
'url': 'webapp/index.php?c=Market&a=openLuckyBox',
|
||
'params': [
|
||
['account', 0, '钱包账号'],
|
||
['token', '', 'token'],
|
||
['token_id', '', '宝箱token_id'],
|
||
['net_id', '', '网络id'],
|
||
],
|
||
'response': [
|
||
_common.RspHead(),
|
||
['!tokenIds', [''], '开出的物品tokenId列表'],
|
||
['nonce', '', 'nonce'],
|
||
['signature', '', 'signature'],
|
||
]
|
||
},
|
||
{
|
||
'name': 'queryLuckyBox',
|
||
'desc': '查询开宝箱信息',
|
||
'group': 'Market',
|
||
'url': 'webapp/index.php?c=Market&a=queryLuckyBox',
|
||
'params': [
|
||
['account', 0, '钱包账号'],
|
||
['token', '', 'token'],
|
||
['token_id', '', '宝箱token_id'],
|
||
['txhash', '', 'txhash'],
|
||
['net_id', '', '网络id'],
|
||
],
|
||
'response': [
|
||
_common.RspHead(),
|
||
['state', '', '0:开启中 1:开启成功'],
|
||
['!nfts', [_common.NftDetail()], '获得的nft列表'],
|
||
]
|
||
},
|
||
{
|
||
'name': 'activateNft',
|
||
'desc': '激活nft',
|
||
'group': 'Market',
|
||
'url': 'webapp/index.php?c=Market&a=activateNft',
|
||
'params': [
|
||
['account', 0, '钱包账号'],
|
||
['token', '', 'token'],
|
||
['token_id', '', 'token_id'],
|
||
['net_id', '', '网络id'],
|
||
],
|
||
'response': [
|
||
_common.RspHead(),
|
||
['new_token_id', '', '新nft tokenid'],
|
||
['nonce', '', 'nonce'],
|
||
['signature', '', 'signature'],
|
||
]
|
||
},
|
||
{
|
||
'name': 'queryActivateResult',
|
||
'desc': '查询开宝箱信息',
|
||
'group': 'Market',
|
||
'url': 'webapp/index.php?c=Market&a=queryActivateResult',
|
||
'params': [
|
||
['account', 0, '钱包账号'],
|
||
['token', '', 'token'],
|
||
['token_id', '', '宝箱token_id'],
|
||
['txhash', '', 'txhash'],
|
||
['net_id', '', '网络id'],
|
||
],
|
||
'response': [
|
||
_common.RspHead(),
|
||
['state', '', '0:激活中 1:激活成功'],
|
||
['nft', _common.NftDetail(), '新nft信息'],
|
||
]
|
||
},
|
||
{
|
||
'name': 'queryOrder',
|
||
'desc': '查询订单状态',
|
||
'group': 'Market',
|
||
'url': 'webapp/index.php?c=Market&a=queryOrder',
|
||
'params': [
|
||
['account', 0, '钱包账号'],
|
||
['token', '', 'token'],
|
||
['order_id', 0, '订单id'],
|
||
],
|
||
'response': [
|
||
_common.RspHead(errcode='当errcode!=0的时候客户端不需要再调用(停止定时器)'),
|
||
['state', 0, '0:订单不存在 1:购买成功 2:交易处理中 3:交易失败'],
|
||
]
|
||
},
|
||
{
|
||
'name': 'getNftList',
|
||
'desc': '获取账号对应的nft列表',
|
||
'group': 'Market',
|
||
'url': 'webapp/index.php?c=Market&a=getNftList',
|
||
'params': [
|
||
['account', '', '账号id'],
|
||
['token', '', 'token'],
|
||
['page', 0, '获取第几页数据'],
|
||
['type', '', 'nft类型 1:英雄 2:枪支 3:芯片 [可选]如果不传则所有'],
|
||
['state', '', '0:正常状态 1:出售中 2:出租中 [可选]如果不传则所有'],
|
||
],
|
||
'response': [
|
||
_common.RspHead(),
|
||
['!nfts', [_common.NftDetail()], 'nft列表'],
|
||
['page', _common.Page(), '分页信息'],
|
||
]
|
||
},
|
||
{
|
||
'name': 'getNftDetail',
|
||
'desc': '获取商品详情',
|
||
'group': 'Market',
|
||
'url': 'webapp/index.php?c=Market&a=getNftDetail',
|
||
'params': [
|
||
['account', '', '账号id'],
|
||
['token', '', 'token'],
|
||
['token_id', '', 'token_id'],
|
||
],
|
||
'response': [
|
||
_common.RspHead(),
|
||
['info', _common.NftDetail(), '商品详细信息'],
|
||
]
|
||
},
|
||
{
|
||
'name': '/api/nft/info',
|
||
'desc': '获取nft信息',
|
||
'group': 'Market',
|
||
'url': '/api/nft/info/{$tokenId}',
|
||
'params': [
|
||
['account', '', '账号id'],
|
||
],
|
||
'response': [
|
||
_common.NftView(),
|
||
]
|
||
},
|
||
]
|