Skip to content

Commit

Permalink
refactor: altered orderbook denoms to be taken from instantiate message
Browse files Browse the repository at this point in the history
  • Loading branch information
crnbarr93 committed Jul 15, 2024
1 parent e3bdd37 commit 812975c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
13 changes: 11 additions & 2 deletions packages/server/src/queries/complex/orderbooks/pools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ const orderbookPoolsCache = new LRUCache<string, CacheEntry>(

const orderBookCodeIds = [865];

interface OrderbookInstantiateMsg {
quote_denom: string;
base_denom: string;
}

export interface Orderbook {
baseDenom: string;
quoteDenom: string;
Expand All @@ -31,9 +36,13 @@ export function getOrderbookPools() {
})
.map((pool) => {
const chainModel = pool.chain_model as ChainCosmwasmPool;
const instMsg: OrderbookInstantiateMsg = JSON.parse(
atob(chainModel.instantiate_msg)
);

return {
baseDenom: pool.balances[1].denom,
quoteDenom: pool.balances[0].denom,
baseDenom: instMsg.base_denom,
quoteDenom: instMsg.quote_denom,
contractAddress: chainModel.contract_address,
poolId: chainModel.pool_id.toString(),
};
Expand Down
2 changes: 0 additions & 2 deletions packages/web/components/place-limit-tool/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,6 @@ export const PlaceLimitTool: FunctionComponent<PlaceLimitToolProps> = observer(
Boolean(swapState.marketState.error) ||
Boolean(swapState.marketState.networkFeeError) ||
swapState.marketState.isQuoteLoading ||
swapState.marketState.inAmountInput.isTyping ||
swapState.marketState.isQuoteLoading)) ||
swapState.marketState.inAmountInput.isTyping)) ||
!swapState.isBalancesFetched ||
swapState.isMakerFeeLoading ||
Expand Down
1 change: 1 addition & 0 deletions packages/web/hooks/limit-orders/use-orderbook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export const useOrderbooks = (): {
} => {
const { data: orderbooks, isLoading } =
api.edge.orderbooks.getPools.useQuery();

const onlyStableOrderbooks = useMemo(
() =>
(orderbooks ?? []).filter(({ quoteDenom }) =>
Expand Down

0 comments on commit 812975c

Please sign in to comment.