Skip to content

Commit

Permalink
Merge branch 'master' into develop
Browse files Browse the repository at this point in the history
Merge master into develop
  • Loading branch information
mangrove-automation authored Oct 2, 2024
2 parents dfa3c43 + 4ba3af8 commit d8772f5
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 33 deletions.
13 changes: 2 additions & 11 deletions app/trade/_components/forms/components/market-details.tsx
Original file line number Diff line number Diff line change
@@ -1,22 +1,13 @@
import { Accordion } from "./accordion"
type MarketDetailsProps = {
takerFee?: string
tickSize?: string
spotPrice?: string
minVolume?: string
}

export function MarketDetails({
takerFee,
tickSize,
spotPrice,
minVolume,
}: MarketDetailsProps) {
export function MarketDetails({ takerFee, minVolume }: MarketDetailsProps) {
return (
<Accordion title="Market details">
<MarketDetailsLine title="Taker fee" value={takerFee} />
<MarketDetailsLine title="Tick size" value={tickSize} />
<MarketDetailsLine title="Current spot price" value={spotPrice} />
<MarketDetailsLine title="Fee" value={takerFee} />

{minVolume ? (
<MarketDetailsLine title={`Minimum volume`} value={`${minVolume}`} />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ export default function FromWalletLimitOrderDialog({ form, onClose }: Props) {
receiveToken,
spender,
feeInPercentageAsString,
tickSize,
spotPrice,
} = useTradeInfos("limit", form.bs)

Expand Down Expand Up @@ -242,9 +241,7 @@ export default function FromWalletLimitOrderDialog({ form, onClose }: Props) {
{stepInfos[currentStep - 1]?.body ?? undefined}
<div className="bg-[#041010] rounded-lg p-4 flex items-center">
<MarketDetails
spotPrice={spotPrice}
takerFee={feeInPercentageAsString}
tickSize={tickSize}
minVolume={form.minVolume}
/>
</div>
Expand Down
8 changes: 7 additions & 1 deletion app/trade/_components/forms/limit/hooks/use-limit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,13 @@ export function useLimit(props: Props) {
!isNaN(Number(state.values.receive)) &&
isFinite(Number(state.values.receive))

console.log({
sendIsValid,
values: state.values,
send: state.values.send,
})
const sendAmount = parseUnits(
sendIsValid ? state.values.send : "0",
sendIsValid ? state.values.send ?? 0 : "0",
sendToken?.decimals || 18,
)
const receiveAmount = parseUnits(
Expand Down Expand Up @@ -176,6 +181,7 @@ export function useLimit(props: Props) {
if (!currentMarket) return
const limit = Number(form?.getFieldValue("limitPrice") ?? 0)
const receive = Number(form?.getFieldValue("receive") ?? 0)
console.log({ limit, receive })
form.setFieldValue(
"send",
(bs === BS.buy ? receive * limit : receive / limit).toString(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ export default function FromWalletMarketOrderDialog({ form, onClose }: Props) {
receiveToken,
spender,
feeInPercentageAsString,
tickSize,
spotPrice,
} = useTradeInfos("market", form.bs)

Expand Down Expand Up @@ -188,11 +187,7 @@ export default function FromWalletMarketOrderDialog({ form, onClose }: Props) {
<div className="space-y-2">
{stepInfos[currentStep - 1]?.body ?? undefined}
<div className="bg-[#041010] rounded-lg p-4 flex items-center">
<MarketDetails
spotPrice={spotPrice}
takerFee={feeInPercentageAsString}
tickSize={tickSize}
/>
<MarketDetails takerFee={feeInPercentageAsString} />
</div>
</div>
</Dialog.Description>
Expand Down
7 changes: 1 addition & 6 deletions app/trade/_components/forms/market/market.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ export function Market() {
send,
quote,
avgPrice,
tickSize,
feeInPercentageAsString,
spotPrice,
} = useMarketForm({ onSubmit: (formData) => setFormData(formData) })
Expand Down Expand Up @@ -275,11 +274,7 @@ export function Market() {
</form.Field>
<Separator className="!my-6" />

<MarketDetails
takerFee={feeInPercentageAsString}
tickSize={tickSize}
spotPrice={spotPrice}
/>
<MarketDetails takerFee={feeInPercentageAsString} />

<form.Subscribe
selector={(state) => [
Expand Down
4 changes: 0 additions & 4 deletions app/trade/_components/prices-bar/prices-bar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,6 @@ export function PricesBar() {
const { book } = useBook({})
const lowestAskPrice = book?.asks[0]?.price
const highestBidPrice = book?.bids[0]?.price
const priceDecimals = determineDecimals(
lowestAskPrice,
quote?.priceDisplayDecimals,
)

let spotPrice =
lowestAskPrice && highestBidPrice
Expand Down
4 changes: 2 additions & 2 deletions app/trade/_components/tables/tables.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ import { useOrders } from "./orders/hooks/use-orders"
import { Orders } from "./orders/orders"

export enum TradeTables {
ORDERS = "orders",
FILLS = "fills",
ORDERS = "Open Orders",
FILLS = "Orders History",
}

const TABS_CONTENT = {
Expand Down

0 comments on commit d8772f5

Please sign in to comment.