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

feat: update infolist api #7

Merged
merged 3 commits into from
Dec 27, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
83 changes: 68 additions & 15 deletions trpc.d.cts
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,35 @@ declare const appRouter: _trpc_server_unstable_core_do_not_import.BuiltRouter<{
errorShape: _trpc_server_unstable_core_do_not_import.DefaultErrorShape;
transformer: true;
}, {
infoList: _trpc_server.TRPCQueryProcedure<{
coinList: _trpc_server.TRPCQueryProcedure<{
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does the router only work with xUDT? If so, it should be changed to xudtList for clarity.

Copy link

@yixyxiu yixyxiu Dec 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This API returns more than just xUDT types. It should at least include some custom UDT types. Once SSRI is ready, there will be even more types, but they all belong to the category of Coin, or you could say Token or UDT. Which one do you think fits better—coinList , tokenList, or udtList? I have no preference.

input: {
pageSize?: number | undefined;
pageIndex?: number | undefined;
};
} | undefined;
output: {
data: {
symbol: string | null;
id: string;
name: string | null;
decimals: number | null;
icon: string | null;
tags: string[];
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;
circulatingSupply: string | null;
fdv: string | null;
priceChange24h: number | null;
txCount24h: number;
};
}[];
pagination: {
hasNext: boolean;
Expand Down Expand Up @@ -82,12 +98,28 @@ declare const appRouter: _trpc_server_unstable_core_do_not_import.BuiltRouter<{
assetId: string;
};
output: {
symbol: string | null;
id: string;
name: string | null;
decimals: number | null;
icon: string | null;
tags: string[];
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;
circulatingSupply: string | null;
fdv: string | null;
priceChange24h: number | null;
txCount24h: number;
};
} | null;
}>;
quote: _trpc_server.TRPCQueryProcedure<{
Expand All @@ -103,9 +135,9 @@ declare const appRouter: _trpc_server_unstable_core_do_not_import.BuiltRouter<{
price: string | null;
marketCap: string | null;
volume24h: string | null;
priceChange24h: number | null;
circulatingSupply: string | null;
fdv: string | null;
priceChange24h: number | null;
txCount24h: number;
} | null;
}>;
Expand All @@ -129,6 +161,27 @@ declare const appRouter: _trpc_server_unstable_core_do_not_import.BuiltRouter<{
};
};
}>;
addressHoldAssets: _trpc_server.TRPCQueryProcedure<{
input: {
address: string;
};
output: {
assets: {
info: {
symbol: string | null;
id: string;
name: string | null;
decimals: number | null;
icon: string | null;
};
value: string;
amount: string;
price: string | null;
priceChange24h: number | null;
}[];
balance: string;
} | null;
}>;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里有一些问题。

首先:某一个地址下,它可能有多种资产,output返回的是一个资产列表的数组;
其次,资产列表里的每个元素,需要带上UDT的基本信息(name, symbol, typeHash等),以及balance、price(该资产的价格);
另外:addressHoldAssets 这个名字看上去是会包含udt 和 dob 等资产的,下一期如果要支持显示某个地址下的 DOBs 列表(前端通过切换不同的tab显示coins 和 dobs 资产),该如何支持呢?是在这个接口上扩展,还是新开一个接口?

transactionList: _trpc_server.TRPCQueryProcedure<{
input: {
assetId: string;
Expand Down