Skip to content

Commit

Permalink
fix: all txs were showing in "My Orders" with unconnected wallets
Browse files Browse the repository at this point in the history
  • Loading branch information
dib542 committed Jun 3, 2024
1 parent 3fe8cc6 commit 9792f6c
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions src/lib/web3/hooks/useUserLimitOrders.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import Long from 'long';
import { useMemo } from 'react';
import { useInfiniteQuery } from '@tanstack/react-query';
import type { PageRequest } from '@duality-labs/neutronjs/types/codegen/cosmos/base/query/v1beta1/pagination';
Expand Down Expand Up @@ -30,12 +31,16 @@ export function useUserLimitOrderTranches() {
pageParam: Uint8Array | undefined;
}): Promise<QueryAllUserLimitOrdersResponse> => {
const client = await restClientPromise;
return client.dex.limitOrderTrancheUserAllByAddress({
address: address || '',
pagination: {
key: pageKey || [],
} as PageRequest,
});
return address
? // query chain for user's transactions
client.dex.limitOrderTrancheUserAllByAddress({
address,
pagination: {
key: pageKey || [],
} as PageRequest,
})
: // or return no transactions
{ limit_orders: [], pagination: { total: Long.ZERO } };
},
initialPageParam: undefined as Uint8Array | undefined,
getNextPageParam: (lastPage): Uint8Array | undefined => {
Expand Down

0 comments on commit 9792f6c

Please sign in to comment.