Skip to content

Commit

Permalink
chore: removed spot price query as it is now unused
Browse files Browse the repository at this point in the history
  • Loading branch information
crnbarr93 committed Jul 1, 2024
1 parent 5e33bf0 commit 457536e
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 93 deletions.
1 change: 0 additions & 1 deletion packages/server/src/queries/complex/orderbooks/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@ export * from "./active-orders";
export * from "./denoms";
export * from "./maker-fee";
export * from "./orderbook-state";
export * from "./spot-price";
export * from "./tick-state";
36 changes: 0 additions & 36 deletions packages/server/src/queries/complex/orderbooks/spot-price.ts

This file was deleted.

21 changes: 0 additions & 21 deletions packages/trpc/src/orderbook-router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import {
getOrderbookActiveOrders,
getOrderbookDenoms,
getOrderbookMakerFee,
getOrderbookSpotPrice,
getOrderbookState,
getOrderbookTickState,
getOrderbookTickUnrealizedCancels,
Expand Down Expand Up @@ -285,26 +284,6 @@ export const orderbookRouter = createTRPCRouter({
limit: input.limit,
});
}),
getSpotPrice: publicProcedure
.input(
z
.object({
quoteAssetDenom: z.string(),
baseAssetDenom: z.string(),
})
.required()
.and(OsmoAddressSchema.required())
)
.query(async ({ input, ctx }) => {
const { quoteAssetDenom, baseAssetDenom, osmoAddress } = input;
const spotPrice = await getOrderbookSpotPrice({
orderbookAddress: osmoAddress,
quoteAssetDenom: quoteAssetDenom,
baseAssetDenom: baseAssetDenom,
chainList: ctx.chainList,
});
return spotPrice;
}),
getOrderbookState: publicProcedure
.input(OsmoAddressSchema.required())
.query(async ({ input, ctx }) => {
Expand Down
35 changes: 0 additions & 35 deletions packages/web/hooks/limit-orders/use-orderbook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -302,38 +302,3 @@ export const useOrderbookAllActiveOrders = ({
isFetching,
};
};

/**
* Hook to fetch the current spot price of a given pair from an orderbook.
*
* The spot price is determined by the provided quote asset and base asset.
*
* For a BID the quote asset is the base asset and the base asset is the quote asset of the orderbook.
*
* For an ASK the quote asset is the quote asset and the base asset is the base asset of the orderbook.
*
* @param {string} orderbookAddress - The contract address of the orderbook.
* @param {string} quoteAssetDenom - The token out asset denom.
* @param {string} baseAssetDenom - The token in asset denom.
* @returns {Object} An object containing the spot price and the loading state.
*/
export const useOrderbookSpotPrice = ({
orderbookAddress,
quoteAssetDenom,
baseAssetDenom,
}: {
orderbookAddress: string;
quoteAssetDenom: string;
baseAssetDenom: string;
}) => {
const { data: spotPrice, isLoading } =
api.edge.orderbooks.getSpotPrice.useQuery({
osmoAddress: orderbookAddress,
quoteAssetDenom,
baseAssetDenom,
});
return {
spotPrice,
isLoading,
};
};

0 comments on commit 457536e

Please sign in to comment.