Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update logic related to fee #348

Merged
merged 5 commits into from
Mar 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"pnpm": ">=10.4.0"
},
"dependencies": {
"@compolabs/spark-orderbook-ts-sdk": "https://registry.npmjs.org/@compolabs/spark-orderbook-ts-sdk/-/spark-orderbook-ts-sdk-1.16.4.tgz",
"@compolabs/spark-orderbook-ts-sdk": "https://registry.npmjs.org/@compolabs/spark-orderbook-ts-sdk/-/spark-orderbook-ts-sdk-1.16.5.tgz",
"@compolabs/tradingview-chart": "^1.0.21",
"@emotion/react": "^11.11.3",
"@emotion/styled": "^11.11.0",
Expand Down Expand Up @@ -107,7 +107,7 @@
"last 1 safari version"
]
},
"packageManager": "pnpm@10.4.0+sha512.6b849d0787d97f8f4e1f03a9b8ff8f038e79e153d6f11ae539ae7c435ff9e796df6a862c991502695c7f9e8fac8aeafc1ac5a8dab47e36148d183832d886dd52",
"packageManager": "pnpm@10.6.3+sha512.bb45e34d50a9a76e858a95837301bfb6bd6d35aea2c5d52094fa497a467c43f5c440103ce2511e9e0a2f89c3d6071baac3358fc68ac6fb75e2ceb3d2736065e6",
"pnpm": {
"overrides": {}
}
Expand Down
20 changes: 10 additions & 10 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 1 addition & 8 deletions src/blockchain/FuelNetwork.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@ import { Account, B256Address } from "fuels";
import { makeObservable } from "mobx";
import { Nullable } from "tsdef";

import SparkOrderBookSdk, { OrderType, WriteTransactionResponse } from "@compolabs/spark-orderbook-ts-sdk";
import SparkOrderBookSdk, { BN, OrderType, WriteTransactionResponse } from "@compolabs/spark-orderbook-ts-sdk";

import BN from "@utils/BN";
import { CONFIG } from "@utils/getConfig";

import { Token } from "@entity";
Expand Down Expand Up @@ -100,12 +99,6 @@ export class FuelNetwork {
await this.walletManager.addAsset(assetId);
};

createSpotOrder = async (
...params: Parameters<typeof this.orderbookSdk.createOrder>
): Promise<WriteTransactionResponse> => {
return this.orderbookSdk.createOrder(...params);
};

createSpotOrderWithDeposit = async (
...params: Parameters<typeof this.orderbookSdk.createOrderWithDeposit>
): Promise<WriteTransactionResponse> => {
Expand Down
2 changes: 1 addition & 1 deletion src/blockchain/types/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import BN from "@utils/BN";
import { BN } from "@compolabs/spark-orderbook-ts-sdk";

export type FetchTradesParams = {
limit: number;
Expand Down
2 changes: 1 addition & 1 deletion src/components/CompressedNumber.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { useMemo } from "react";

import BN from "@utils/BN";
import { BN } from "@compolabs/spark-orderbook-ts-sdk";

import { SmartFlex } from "./SmartFlex";
import Text from "./Text";
Expand Down
3 changes: 2 additions & 1 deletion src/components/Modal/AccountInfoSheet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@ import React from "react";
import styled from "@emotion/styled";
import copy from "copy-to-clipboard";

import { BN } from "@compolabs/spark-orderbook-ts-sdk";

import copyIcon from "@assets/icons/copy.svg";
import linkIcon from "@assets/icons/link.svg";
import logoutIcon from "@assets/icons/logout.svg";

import { useWallet } from "@hooks/useWallet";
import { useStores } from "@stores";

import BN from "@utils/BN";
import { getExplorerLinkByAddress } from "@utils/getExplorerLink";

import { FuelNetwork } from "@blockchain";
Expand Down
2 changes: 1 addition & 1 deletion src/components/Modal/SpotOrderSettingsSheet.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from "react";
import styled from "@emotion/styled";

import BN from "@utils/BN";
import { BN } from "@compolabs/spark-orderbook-ts-sdk";

import Sheet from "../Sheet";
import { SmartFlex } from "../SmartFlex";
Expand Down
3 changes: 2 additions & 1 deletion src/components/SelectAssets/AssetBlock.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@ import { useTheme } from "@emotion/react";
import styled from "@emotion/styled";
import { observer } from "mobx-react";

import { BN } from "@compolabs/spark-orderbook-ts-sdk";

import { SmartFlex } from "@components/SmartFlex";
import Text from "@components/Text";

import { useStores } from "@stores";

import { DEFAULT_DECIMALS } from "@constants";
import BN from "@utils/BN";

import { AssetBlockData } from "./SelectAssetsInput";

Expand Down
3 changes: 2 additions & 1 deletion src/components/SelectAssets/SelectAssetsInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import React, { HTMLAttributes, useState } from "react";
import { useTheme } from "@emotion/react";
import styled from "@emotion/styled";

import { BN } from "@compolabs/spark-orderbook-ts-sdk";

import Button from "@components/Button";
import { IAssetBlock } from "@components/SelectAssets/AssetBlock";
import { SmartFlex } from "@components/SmartFlex";
Expand All @@ -10,7 +12,6 @@ import { BigNumberInput } from "@components/TokenInput/BigNumberInput";
import { TokenSelect } from "@screens/SwapScreen/TokenSelect";

import { DEFAULT_DECIMALS } from "@constants";
import BN from "@utils/BN";

import { Token } from "@entity";

Expand Down
3 changes: 2 additions & 1 deletion src/components/TokenInput/BigNumberInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ import React, { useEffect, useRef, useState } from "react";
import BigNumber from "bignumber.js";
import { Nullable } from "tsdef";

import { BN } from "@compolabs/spark-orderbook-ts-sdk";

import { DEFAULT_DECIMALS } from "@constants";
import BN from "@utils/BN";

type HTMLInputProps = React.ClassAttributes<HTMLInputElement> & React.InputHTMLAttributes<HTMLInputElement>;

Expand Down
4 changes: 2 additions & 2 deletions src/components/TokenInput/TokenInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ import React, { CSSProperties, useEffect, useState } from "react";
import styled from "@emotion/styled";
import { observer } from "mobx-react-lite";

import { BN } from "@compolabs/spark-orderbook-ts-sdk";

import Chip from "@components/Chip";
import Text, { TEXT_TYPES_MAP } from "@components/Text";
import { media } from "@themes/breakpoints";

import BN from "@utils/BN";

import { FuelNetwork } from "@blockchain";

import AmountInput from "./AmountInput";
Expand Down
3 changes: 2 additions & 1 deletion src/components/WalletButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import styled from "@emotion/styled";
import copy from "copy-to-clipboard";
import { observer } from "mobx-react";

import { BN } from "@compolabs/spark-orderbook-ts-sdk";

import Divider from "@components/Divider";
import { Column, Row } from "@components/Flex";
import Text from "@components/Text";
Expand All @@ -15,7 +17,6 @@ import logoutIcon from "@assets/icons/logout.svg";
import { useWallet } from "@hooks/useWallet";
import { useStores } from "@stores";

import BN from "@utils/BN";
import { getExplorerLinkByAddress } from "@utils/getExplorerLink";

import { FuelNetwork } from "@blockchain";
Expand Down
3 changes: 2 additions & 1 deletion src/entity/PerpMarket.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { makeAutoObservable } from "mobx";

import { BN } from "@compolabs/spark-orderbook-ts-sdk";

import { FuelNetwork } from "@blockchain";

import { DEFAULT_DECIMALS } from "../constants";
import BN from "../utils/BN";

import { Token } from "./Token";

Expand Down
3 changes: 2 additions & 1 deletion src/entity/PerpMarketTrade.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ import dayjs, { Dayjs } from "dayjs";
import { Address, isBech32 } from "fuels";
import { Nullable } from "tsdef";

import { BN } from "@compolabs/spark-orderbook-ts-sdk";

import { DEFAULT_DECIMALS } from "@constants";
import BN from "@utils/BN";

import { FuelNetwork } from "@blockchain";

Expand Down
4 changes: 2 additions & 2 deletions src/entity/PerpOrder.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { makeAutoObservable } from "mobx";

import { BN } from "@compolabs/spark-orderbook-ts-sdk";

import { DEFAULT_DECIMALS } from "@constants";
import { toCurrency } from "@utils/toCurrency";

import { FuelNetwork } from "@blockchain";

import BN from "../utils/BN";

import { Token } from "./Token";

interface PerpOrderParams {
Expand Down
4 changes: 2 additions & 2 deletions src/entity/PerpPosition.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { makeAutoObservable } from "mobx";

import { FuelNetwork } from "@blockchain";
import { BN } from "@compolabs/spark-orderbook-ts-sdk";

import BN from "../utils/BN";
import { FuelNetwork } from "@blockchain";

import { Token } from "./Token";

Expand Down
3 changes: 2 additions & 1 deletion src/entity/SpotMarket.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { makeAutoObservable } from "mobx";

import { BN } from "@compolabs/spark-orderbook-ts-sdk";

import { DEFAULT_DECIMALS } from "@constants";
import BN from "@utils/BN";
import { Market } from "@utils/getConfig";

import { FuelNetwork } from "@blockchain";
Expand Down
3 changes: 1 addition & 2 deletions src/entity/SpotMarketOrder.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import dayjs, { Dayjs } from "dayjs";

import { Order } from "@compolabs/spark-orderbook-ts-sdk";
import { BN, Order } from "@compolabs/spark-orderbook-ts-sdk";

import { DEFAULT_DECIMALS } from "@constants";
import BN from "@utils/BN";
import { CONFIG } from "@utils/getConfig";

import { FuelNetwork } from "@blockchain";
Expand Down
3 changes: 2 additions & 1 deletion src/screens/Assets/BalanceBlock/BalanceBlock.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@ import React from "react";
import { useTheme } from "@emotion/react";
import styled from "@emotion/styled";

import { BN } from "@compolabs/spark-orderbook-ts-sdk";

import { AssetBlockData } from "@components/SelectAssets/SelectAssetsInput";
import { SmartFlex } from "@components/SmartFlex";
import Text from "@components/Text";

import { useStores } from "@stores";

import { DEFAULT_DECIMALS } from "@constants";
import BN from "@utils/BN";

interface IBalanceBlock {
icon: React.ReactElement;
Expand Down
3 changes: 2 additions & 1 deletion src/screens/Assets/DepositAssets/DepositAssets.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import { useNavigate } from "react-router-dom";
import styled from "@emotion/styled";
import { observer } from "mobx-react";

import { BN } from "@compolabs/spark-orderbook-ts-sdk";

import Button from "@components/Button";
import { IAssetBlock } from "@components/SelectAssets/AssetBlock";
import SelectAssetsInput from "@components/SelectAssets/SelectAssetsInput";
Expand All @@ -20,7 +22,6 @@ import { useStores } from "@stores";
import { BalanceBlock } from "@screens/Assets/BalanceBlock/BalanceBlock";

import { DEFAULT_DECIMALS } from "@constants";
import BN from "@utils/BN";

interface DepositAssetsProps {
setStep: (value: number) => void;
Expand Down
3 changes: 2 additions & 1 deletion src/screens/Assets/MainAssets/MainAssets.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import { useTheme } from "@emotion/react";
import styled from "@emotion/styled";
import { observer } from "mobx-react";

import { BN } from "@compolabs/spark-orderbook-ts-sdk";

import Button from "@components/Button";
import { Column } from "@components/Flex";
import AssetBlock from "@components/SelectAssets/AssetBlock";
Expand All @@ -21,7 +23,6 @@ import { MIXPANEL_EVENTS } from "@stores/MixPanelStore";
import { MODAL_TYPE } from "@stores/ModalStore";

import { BRIDGE_LINK } from "@constants";
import BN from "@utils/BN";

interface MainAssetsProps {
setStep: (value: number) => void;
Expand Down
3 changes: 2 additions & 1 deletion src/screens/Assets/WithdrawAssets/WithdrawAssets.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import React, { useEffect, useState } from "react";
import styled from "@emotion/styled";
import { observer } from "mobx-react";

import { BN } from "@compolabs/spark-orderbook-ts-sdk";

import Button from "@components/Button";
import { IAssetBlock } from "@components/SelectAssets/AssetBlock";
import SelectAssetsInput from "@components/SelectAssets/SelectAssetsInput";
Expand All @@ -20,7 +22,6 @@ import { BalanceBlock } from "@screens/Assets/BalanceBlock/BalanceBlock";
import { ModalEnums, TypeTransaction } from "@screens/Assets/enums/actionEnums";

import { DEFAULT_DECIMALS } from "@constants";
import BN from "@utils/BN";

interface WithdrawAssets {
setStep: (value: number) => void;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import styled from "@emotion/styled";
import copy from "copy-to-clipboard";
import { observer } from "mobx-react";

import { GetCompetitionResponse } from "@compolabs/spark-orderbook-ts-sdk";
import { BN, GetCompetitionResponse } from "@compolabs/spark-orderbook-ts-sdk";

import { SmartFlex } from "@components/SmartFlex";
import Text from "@components/Text";
Expand All @@ -17,7 +17,6 @@ import three from "@assets/images/3st.png";

import { useStores } from "@stores";

import BN from "@utils/BN";
import { toCurrency } from "@utils/toCurrency.ts";

const generatePosition = (key: number) => {
Expand Down
4 changes: 1 addition & 3 deletions src/screens/Leaderboard/LeaderboardTable/LeaderboardItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import styled from "@emotion/styled";
import copy from "copy-to-clipboard";
import { observer } from "mobx-react";

import { TraderVolumeResponse } from "@compolabs/spark-orderbook-ts-sdk";
import { BN, TraderVolumeResponse } from "@compolabs/spark-orderbook-ts-sdk";

import { SmartFlex } from "@components/SmartFlex";
import Text, { TEXT_TYPES_MAP } from "@components/Text";
Expand All @@ -19,8 +19,6 @@ import { LeaderboardStore, useStores } from "@stores";

import { pnlTimeline } from "@screens/Dashboard/const";

import BN from "@utils/BN";

const generatePosition = (key: TraderVolumeResponse["id"]) => {
if (key === 1) return <img alt="1st" height={40} src={oneSt} width={40} />;
if (key === 2) return <img alt="2st" height={40} src={twoSt} width={40} />;
Expand Down
Loading