Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[P0]需求:将 infoList 名改成 coinList,内含info、quote #1

Open
yixyxiu opened this issue Dec 22, 2024 · 3 comments
Open
Assignees

Comments

@yixyxiu
Copy link

yixyxiu commented Dec 22, 2024

现在获取coinList的接口是rgbpp.infoList,定义如下:

infoList: _trpc_server.TRPCQueryProcedure<{
            input: {
                pageSize?: number | undefined;
                pageIndex?: number | undefined;
            };
            output: {
                data: {
                    symbol: string | null;
                    id: string;
                    name: string | null;
                    decimals: number | null;
                    icon: string | null;
                    tags: string[];
                }[];
                pagination: {
                    hasNext: boolean;
                    total?: number | undefined;
                };
            };
        }>;

考虑到以下原因, 我们提出将 rgbpp.infoList 名改成 rgbpp.coinList,内含info、quote:

  • infoList 名字不够明确,无法从名字得之该接口的用处,coinList 则更好地表达了意思
  • infoList 返回的字段仅仅一些info,而实际需求页面里,出了获取代币的基础信息之外,还需要行情数据,且均在同一个列表里显示,当前端出现排序需求时,该接口很难满足;
  • 由于 infoList 名字范围较广(它可以是任意资产的info),未来如果新增DOB资产列表的话,如果强制塞到infoList里,DOB和xUDT字段不同,有些牵强。如果将infoList 改为 coinList, 未来增加DOB资产列表,则可以定义一个dobList的接口,二者互不影响,更具有维护性。

修改后的接口定义大致如下:

coinList: _trpc_server.TRPCQueryProcedure<{
            input: {
                pageSize?: number | undefined;
                pageIndex?: number | undefined;
            };
            output: {
                data: {
                    info: {
                      symbol: string | null;
                      id: string;
                      name: string | null;
                      decimals: number | null;
                      icon: string | null;
                      tags: string[];
                   },
                   quote: {
                      totalSupply: string | null;
                      holderCount: {
                          network: "ckb" | "btc" | "doge" | "unknown";
                          count: number;
                      }[];
                      price: string | null;
                      marketCap: string | null;
                      volume24h: string | null;
                      priceChange24h: number | null;
                      circulatingSupply: string | null;
                      fdv: string | null;
                      txCount24h: number;
                   }
                }[];
                pagination: {
                    hasNext: boolean;
                    total?: number | undefined;
                };
            };
        }>;

这里output.data里的infoquote分别是现在infoList返回和quote的返回值,是否需要加这一层由数据平台定,只要里面的元素是两者的合集就行。

@yixyxiu
Copy link
Author

yixyxiu commented Dec 22, 2024

同理,如果查询某个地址下的资产列表(分为coin,dob),接口名也建议与上面一致,也即:address.coinList,address.dobList,尽量避免用infoList、assetList这种范围较宽泛的。

@yixyxiu
Copy link
Author

yixyxiu commented Dec 23, 2024

对应需求文档描述:见 子页面 2: RGB++ Asset List(FT)章节。

@poor-defined poor-defined changed the title 需求:将 infoList 名改成 coinList,内含info、quote [P0]需求:将 infoList 名改成 coinList,内含info、quote Dec 26, 2024
@sfsf332
Copy link

sfsf332 commented Dec 27, 2024

这个接口的pagination 还是没有total的数字吗

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants