Skip to content

Commit

Permalink
fix: canonical token interchain transfer
Browse files Browse the repository at this point in the history
  • Loading branch information
alanrsoares committed Jan 9, 2024
1 parent 4f1655b commit a6bf03f
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ export function useInterchainTokenServiceTransferMutation(
// eslint-disable-next-line react-hooks/exhaustive-deps
[
address,
sendTokenData?.hash,
approveERC20Recepit,
config.destinationChainName,
interchainTransferAsync,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,15 @@ export const getMyInterchainTokens = protectedProcedure
const pageIndex = Math.floor(input.offset / input.limit);

// return paginated results
const page = sorted.slice(input.offset, input.offset + input.limit);
const items = sorted.slice(input.offset, input.offset + input.limit);

const totalItems = sorted.length;

return {
items: page,
items,
totalItems,
totalPages,
pageIndex,
pageSize: input.limit,
};
});
15 changes: 12 additions & 3 deletions apps/maestro/src/ui/pages/InterchainTokensPage/TokenList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ function getChainNameSlug(chainId: number) {
return chain?.axelarChainName.toLowerCase() ?? "";
}

const PAGE_LIMIT = 12;
const PAGE_LIMIT = 15;

type TokenListProps = {
sessionAddress?: `0x${string}`;
Expand All @@ -46,7 +46,6 @@ const TokenList: FC<TokenListProps> = ({ sessionAddress }) => {
const { computed } = useEVMChainConfigsQuery();

const maybeTokens = Maybe.of(data).map((data) => data.items);

const totalPages = Maybe.of(data).mapOr(0, (data) => data.totalPages);

const filteredTokens = useMemo(
Expand All @@ -65,13 +64,23 @@ const TokenList: FC<TokenListProps> = ({ sessionAddress }) => {
[computed.indexedById, maybeTokens]
);

const totalTokens = Maybe.of(data).mapOr(0, (data) => data.totalItems);

return (
<>
<Page.Title className="flex items-center gap-2">
My Interchain Tokens
{Boolean(filteredTokens?.length) && (
<span className="text-base-content-secondary font-mono text-base">
({filteredTokens?.length})
(
{totalPages > 1 ? (
<>
{offset + 1}-{offset + filteredTokens.length} of {totalTokens}
</>
) : (
totalTokens
)}
)
</span>
)}
</Page.Title>
Expand Down

0 comments on commit a6bf03f

Please sign in to comment.