# -*- coding: utf-8 -*- import _common class NftIntro(object): def __init__(self): self.fields = [ ['idx', 0, 'idx'], ['token_id', '', 'token_id'], ['token_type', 0, 'nft类型 1:英雄 2:枪支 3:芯片'], ['createtime', 0, '创建时间(上架时间)'], ['modifytime', 0, '修改时间(更新价格等)'], ['s_price', 0, '出售价格-暂定'], ['c_name', '', '缓存-名称'], ['c_job', 0, '缓存-职业'], ['c_lv', 0, '缓存-级别'], ['c_id', 0, '缓存-idx'], ['details', _common.NftDetail(), 'nft列表'], ] 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': 'getPhase3Box', 'desc': '开启第三阶段奖励', 'group': 'Market', 'url': 'webapp/index.php?c=Market&a=getPhase3box', 'params': [ ['account', 0, '钱包账号'], ['token', '', 'token'], ['token_id', '', '宝箱token_id'], ['net_id', '', '网络id'], ], 'response': [ _common.RspHead(), ['!rows', [_common.Phase3Box()], '宝箱信息'], ] }, { 'name': 'openPhase3Box', 'desc': '开启第三阶段奖励', 'group': 'Market', 'url': 'webapp/index.php?c=Market&a=openPhase3Box', 'params': [ ['account', 0, '钱包账号'], ['token', '', 'token'], ['token_id', '', '宝箱token_id'], ['net_id', '', '网络id'], ['box_id', '', '箱子id'], ], 'response': [ _common.RspHead(), ] }, { 'name': 'queryPhase3Box', 'desc': '查询阶段3开宝箱信息', 'group': 'Market', 'url': 'webapp/index.php?c=Market&a=queryPhase3Box', 'params': [ ['account', 0, '钱包账号'], ['token', '', 'token'], ['net_id', '', '网络id'], ['box_id', '', '箱子id'], ], 'response': [ _common.RspHead(), ['state', '', '0:开启中 1:开启成功'], ['cec', 0, '奖励cec'], ['!nfts', [_common.NftDetail()], '获得的nft列表'], ] }, { '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(), ] }, { 'name': 'listSellNfts', 'desc': '获取上架出售的NFTs', 'group': 'Market', 'url': 'webapp/index.php?c=Market&a=listSellNfts', 'params': [ ['account', '', '账号id'], ['token', '', 'token'], ['start', 0, '分页开始偏移'], ['page_size', 0, '分页大小'], ['order_method', 0, '排序方式 0:默认排序(当前指向1) 1:上架时间 2:价格 3:星级质量 4:等级 5:能量值 6:生命值 7:攻击力 8:防御力'], ['order_asc', 0, '排序方向, 0:从小到大 1:从大到小'], ['type', 0, '物品类型 1:英雄 2:武器 3:芯片'], ['job_filters', '', '职业过滤(用|分割)'], ['search_filters', '', '搜索过滤(用|分割)'], ['lv_filter', 0, '等级过滤'], ['price_filter', '', '价格过滤(用|分割)'] ], 'response': [ _common.RspHead(), ['total', 0, '出售的列表总数量(当前过滤配置)'], ['start', 0, '有效的分页偏移'], ['page_size', 0, '有效的分页大小'], ['!nfts', [NftIntro()], 'nft列表'], ] }, { 'name': 'listMyNfts', 'desc': '获取自己的NFTs', 'group': 'Market', 'url': 'webapp/index.php?c=Market&a=listMyNfts', 'params': [ ['account', '', '账号id'], ['token', '', 'token'], ['start', 0, '分页开始偏移'], ['page_size', 0, '分页大小'], ['type', 0, '物品类型 1:英雄 2:武器 3:芯片'], ['job_filters', '', '职业过滤(用|分割)'], ['search_filters', '', '搜索过滤(用|分割)'], ['lv_filter', 0, '等级过滤'], ], 'response': [ _common.RspHead(), ['total', 0, '出售的列表总数量(当前过滤配置)'], ['start', 0, '有效的分页偏移'], ['page_size', 0, '有效的分页大小'], ['!nfts', [NftIntro()], 'nft列表'], ] }, { 'name': 'sellMyNft', 'desc': '出售NFT', 'group': 'Market', 'url': 'webapp/index.php?c=Market&a=sellMyNft', 'params': [ ['account', '', '账号id'], ['token', '', 'token'], ['nft_token', '', 'nft_token'], ['s_price', '', '出售价格USDT'], ['payment_token_address', '', 'payment_token_address'], ['nonce', '', 'nonce'], ['signature', '', '签名soliditySha3(type, payment_token_address, price, nonce), 签名的replace客户端做处理'], ['net_id', '', '网络id'], ], 'response': [ _common.RspHead() ] }, { 'name': 'buyNft', 'desc': '购买NFT', 'group': 'Market', 'url': 'webapp/index.php?c=Market&a=buyNft', 'params': [ ['account', '', '账号id'], ['token', '', 'token'], ['nft_token', '', 'nft_token'], ['payment_token_address', '', 'payment_token_address'], ['nonce', '', 'nonce'], ['signature', '', '签名soliditySha3(type, payment_token_address, price, nonce), 签名的replace客户端做处理'], ['net_id', '', '网络id'], ], 'response': [ _common.RspHead() ] }, ]