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

feat: bonsai all turned on #1396

Open
wants to merge 128 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
128 commits
Select commit Hold shift + click to select a range
d2f3489
abacus-ts-types
tyleroooo Nov 27, 2024
f887e6c
add codegen and helpers and manual types
tyleroooo Nov 27, 2024
94ef1e3
Merge remote-tracking branch 'origin/main' into tu/abacus-ts-types
tyleroooo Nov 27, 2024
71f8dd8
fixes
tyleroooo Nov 27, 2024
e0e05ff
fix
tyleroooo Nov 27, 2024
6ddeb68
add websocket layer
tyleroooo Dec 2, 2024
7c25ca7
fix
tyleroooo Dec 2, 2024
8305f2e
fix
tyleroooo Dec 2, 2024
202f169
add market tracker and helpers
tyleroooo Dec 3, 2024
27acae5
fix
tyleroooo Dec 3, 2024
7cd5506
fix
tyleroooo Dec 3, 2024
595e1a0
bunch of fixes and refactors
tyleroooo Dec 4, 2024
306b31b
fix
tyleroooo Dec 5, 2024
7a85a86
Merge remote-tracking branch 'origin/main' into tu/abacus-ts-types
tyleroooo Dec 5, 2024
91f1196
fix
tyleroooo Dec 6, 2024
15621c1
add all new
tyleroooo Dec 6, 2024
d0855de
Merge remote-tracking branch 'origin/main' into tu/abacus-ts-types
tyleroooo Dec 6, 2024
fd1a39d
fixes
tyleroooo Dec 6, 2024
0da5633
add more data
tyleroooo Dec 6, 2024
3cadec2
went wild
tyleroooo Dec 9, 2024
1c516a3
fixes
tyleroooo Dec 9, 2024
f0cfc7a
fix
tyleroooo Dec 9, 2024
0198c59
move files around, fix logging
tyleroooo Dec 10, 2024
6189fa1
fix
tyleroooo Dec 10, 2024
dcc53a8
fix
tyleroooo Dec 10, 2024
75ff184
fix
tyleroooo Dec 10, 2024
6856775
fix
tyleroooo Dec 10, 2024
88cb956
fix
tyleroooo Dec 10, 2024
4f4e061
fix
tyleroooo Dec 10, 2024
e965fb5
fix
tyleroooo Dec 10, 2024
74f78ef
start
tyleroooo Dec 10, 2024
5172c36
fix
tyleroooo Dec 10, 2024
134567d
Merge branch 'tu/abacus-ts-types' into tu/abacus-ts-2
tyleroooo Dec 10, 2024
5486c65
fix
tyleroooo Dec 10, 2024
a6fe44f
fix
tyleroooo Dec 10, 2024
07ce170
Merge branch 'tu/abacus-ts-types' into tu/abacus-ts-2
tyleroooo Dec 10, 2024
13e0acb
more types
tyleroooo Dec 11, 2024
59a27a0
updates
tyleroooo Dec 12, 2024
bfc405e
fix
tyleroooo Dec 12, 2024
917832c
fixes
tyleroooo Dec 12, 2024
9772e4d
merge
tyleroooo Dec 12, 2024
41bb0af
fix
tyleroooo Dec 12, 2024
e27402c
Merge branch 'tu/abacus-ts-types' into tu/abacus-ts-2
tyleroooo Dec 12, 2024
73d52e8
fix
tyleroooo Dec 12, 2024
2487d1d
fix horrible stupid mistake
tyleroooo Dec 12, 2024
a58d832
Merge branch 'tu/abacus-ts-types' into tu/abacus-ts-2
tyleroooo Dec 12, 2024
c419034
more calc
tyleroooo Dec 12, 2024
eadb0b4
fixes
tyleroooo Dec 13, 2024
e7d5a2a
order calculations
tyleroooo Dec 13, 2024
2c7563a
fix
tyleroooo Dec 13, 2024
dc2500a
move stuff around
tyleroooo Dec 13, 2024
d1e187c
fix
tyleroooo Dec 16, 2024
2bbe7af
add validator calls
tyleroooo Dec 16, 2024
32beb8b
Merge branch 'tu/abacus-ts-types' into tu/abacus-ts-2
tyleroooo Dec 16, 2024
4882993
fix order calcs
tyleroooo Dec 17, 2024
75c9297
Merge remote-tracking branch 'origin/main' into tu/abacus-ts-types
tyleroooo Dec 17, 2024
4399e36
dedupe
tyleroooo Dec 17, 2024
3c7a33c
Merge remote-tracking branch 'origin/tu/abacus-ts-types' into tu/abac…
tyleroooo Dec 17, 2024
a226648
fix
tyleroooo Dec 17, 2024
684de6b
fix
tyleroooo Dec 17, 2024
5fbe076
add
tyleroooo Dec 17, 2024
f3ec57f
Merge remote-tracking branch 'origin/tu/abacus-ts-types' into tu/abac…
tyleroooo Dec 17, 2024
517bd47
fix
tyleroooo Dec 17, 2024
c868496
fix
tyleroooo Dec 17, 2024
d628fd0
fix
tyleroooo Dec 17, 2024
1a9928c
fix
tyleroooo Dec 17, 2024
6e2dff3
fix
tyleroooo Dec 17, 2024
c52f8d0
migrate to positions table
tyleroooo Dec 17, 2024
97aa59d
fix
tyleroooo Dec 17, 2024
3f02331
fix
tyleroooo Dec 17, 2024
2c3419d
small fix
tyleroooo Dec 17, 2024
bd867e9
assets, immerjs, more changes
tyleroooo Dec 17, 2024
2ee4069
fix
tyleroooo Dec 17, 2024
0c567b7
Merge remote-tracking branch 'origin/tu/abacus-ts-types' into tu/abac…
tyleroooo Dec 17, 2024
91ff095
Merge remote-tracking branch 'origin/tu/abacus-ts-2' into tu/migrate-…
tyleroooo Dec 17, 2024
730a055
fix
tyleroooo Dec 17, 2024
d03efed
fix
tyleroooo Dec 17, 2024
78ab949
fills table
tyleroooo Dec 17, 2024
fcc5306
fix
tyleroooo Dec 17, 2024
c9b8375
fix
tyleroooo Dec 17, 2024
7d7d7cb
Merge remote-tracking branch 'origin/tu/abacus-ts-types' into tu/abac…
tyleroooo Dec 17, 2024
4f5c9bb
Merge remote-tracking branch 'origin/tu/abacus-ts-2' into tu/migrate-…
tyleroooo Dec 17, 2024
8c4e1b0
Merge remote-tracking branch 'origin/tu/abacus-ts-2' into tu/migrate-…
tyleroooo Dec 17, 2024
1f9a87f
tiny start
tyleroooo Dec 17, 2024
1846f37
orders table
tyleroooo Dec 18, 2024
ce5abdf
more fixes
tyleroooo Dec 18, 2024
bdabe51
Merge remote-tracking branch 'origin/tu/abacus-ts-2' into tu/migrate-…
tyleroooo Dec 18, 2024
949ff2e
fix
tyleroooo Dec 18, 2024
266764f
Merge remote-tracking branch 'origin/main' into tu/abacus-ts-2
tyleroooo Dec 18, 2024
1c25c01
add markets calculation
tyleroooo Dec 18, 2024
57f6c84
rename to live
tyleroooo Dec 18, 2024
69677c2
fix
tyleroooo Dec 18, 2024
10356cf
fix
tyleroooo Dec 18, 2024
83a0cbc
Merge branch 'tu/abacus-ts-2' into tu/migrate-orders
tyleroooo Dec 18, 2024
a45d2db
fix
tyleroooo Dec 18, 2024
281d112
Merge remote-tracking branch 'origin/main' into tu/migrate-positions
tyleroooo Dec 19, 2024
2db49d5
fix
tyleroooo Dec 19, 2024
212f323
use numb
tyleroooo Dec 19, 2024
2b2fc58
Merge remote-tracking branch 'origin/main' into tu/migrate-fills
tyleroooo Dec 19, 2024
59cf4c0
fix
tyleroooo Dec 19, 2024
7b38400
number on portfolio
tyleroooo Dec 19, 2024
1d27a79
force log
tyleroooo Dec 19, 2024
7144249
Merge remote-tracking branch 'origin/main' into tu/migrate-orders
tyleroooo Dec 19, 2024
a3f39b7
fix
tyleroooo Dec 19, 2024
7f67a33
fix
tyleroooo Dec 19, 2024
5d73d72
fix
tyleroooo Dec 19, 2024
d1486b6
fix
tyleroooo Dec 19, 2024
03f1a20
migrate-account-info
tyleroooo Dec 20, 2024
e2f1279
megalodon-ontology
tyleroooo Dec 20, 2024
cc93cb7
fix
tyleroooo Dec 20, 2024
de0b0d0
fix
tyleroooo Dec 20, 2024
a6925f2
fix
tyleroooo Dec 20, 2024
2e74fe6
fix
tyleroooo Dec 20, 2024
4426bcc
fix
tyleroooo Dec 20, 2024
d82e4e0
turn-on-abacus-ts
tyleroooo Dec 20, 2024
ae124dc
Revert "feat: undo ui-facing new abacus changes (#1390)"
tyleroooo Dec 20, 2024
3bd504f
fix
tyleroooo Dec 20, 2024
1032c24
Merge remote-tracking branch 'origin/revert-1390-tu/undo-ui-facing-ab…
tyleroooo Dec 20, 2024
d9e9a81
Merge remote-tracking branch 'origin/tu/turn-on-abacus-ts' into tu/bo…
tyleroooo Dec 20, 2024
d8859a2
merge1
tyleroooo Dec 20, 2024
dd9f0ef
Merge remote-tracking branch 'origin/tu/migrate-account-info' into tu…
tyleroooo Dec 20, 2024
de23d8e
merge
tyleroooo Dec 20, 2024
1f02709
merge
tyleroooo Dec 20, 2024
475a781
merge
tyleroooo Dec 20, 2024
b134fe1
sync-local-address
tyleroooo Dec 20, 2024
aeda6ed
Merge branch 'tu/sync-local-address' into tu/bonsai-all
tyleroooo Dec 20, 2024
c8f6f7e
fix
tyleroooo Dec 20, 2024
1598c13
fix
tyleroooo Dec 20, 2024
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
20 changes: 19 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,14 @@
"plugin:react-hooks/recommended",
"prettier"
],
"overrides": [],
"overrides": [
{
"files": ["**/abacus-ts/**"],
"rules": {
"no-restricted-imports": "off"
}
}
],
"parserOptions": {
"project": "./tsconfig.json",
"ecmaVersion": "latest",
Expand Down Expand Up @@ -42,6 +49,17 @@
"no-multi-assign": "off",
"no-nested-ternary": "off",
"no-param-reassign": ["error", { "props": false }],
"no-restricted-imports": [
"error",
{
"patterns": [
"@/abacus-ts/*",
"!@/abacus-ts/ontology",
"!@/abacus-ts/lib",
"!@/abacus-ts/summaryTypes"
]
}
],
"no-return-assign": "off",
"no-return-await": "off",
"no-underscore-dangle": "off",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
"@datadog/browser-logs": "^5.23.3",
"@dydxprotocol/v4-abacus": "1.13.39",
"@dydxprotocol/v4-client-js": "1.15.1",
"@dydxprotocol/v4-localization": "^1.1.257",
"@dydxprotocol/v4-localization": "^1.1.259",
"@dydxprotocol/v4-proto": "^7.0.0-dev.0",
"@emotion/is-prop-valid": "^1.3.0",
"@funkit/connect": "^4.0.3",
Expand Down
8 changes: 4 additions & 4 deletions pnpm-lock.yaml

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

11 changes: 4 additions & 7 deletions src/abacus-ts/lib/mapLoadable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,15 @@ export function mergeLoadableData<T, R>(
} as any;
}

// converts idle to pending and if a status has valid data is counts as success
export function mergeLoadableStatus(
...status: Array<Loadable<any>>
): Exclude<Loadable<any>['status'], 'idle'> {
export function mergeLoadableStatus(...status: Array<Loadable<any>>): Loadable<any>['status'] {
if (status.some((s) => s.status === 'error' && s.data == null)) {
return 'error';
}
if (status.some((s) => s.status === 'idle')) {
return 'pending';
}
if (status.some((s) => s.status === 'pending' && s.data == null)) {
return 'pending';
}
if (status.some((s) => s.status === 'idle')) {
return 'idle';
}
return 'success';
}
2 changes: 1 addition & 1 deletion src/abacus-ts/logs.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { log } from '@/lib/telemetry';

export function logAbacusTsError(source: string, message: string, ...args: any[]) {
log(`${source}: ${message}`, undefined, { context: args });
log(`${source}: ${message}`, undefined, { context: args }, true);
}
98 changes: 98 additions & 0 deletions src/abacus-ts/ontology.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
import { type RootState } from '@/state/_store';
import { getCurrentMarketId } from '@/state/perpetualsSelectors';

import {
getCurrentMarketAccountFills,
selectAccountFills,
selectAccountFillsLoading,
selectAccountOrdersLoading,
selectCurrentMarketOpenOrders,
selectCurrentMarketOrderHistory,
selectOpenOrders,
selectOrderHistory,
selectParentSubaccountOpenPositions,
selectParentSubaccountOpenPositionsLoading,
selectParentSubaccountSummary,
selectParentSubaccountSummaryLoading,
} from './selectors/account';
import {
selectAllAssetsInfo,
selectAllAssetsInfoLoading,
selectCurrentMarketAssetInfo,
} from './selectors/assets';
import {
selectRawIndexerHeightData,
selectRawIndexerHeightDataLoading,
selectRawValidatorHeightData,
selectRawValidatorHeightDataLoading,
} from './selectors/base';
import {
selectAllMarketsInfo,
selectAllMarketsInfoLoading,
selectCurrentMarketInfo,
} from './selectors/markets';

// every leaf is a selector or a paramaterized selector
type NestedSelectors = {
[K: string]:
| NestedSelectors
| ((state: RootState) => any)
| (() => (state: RootState, ...other: any[]) => any);
};

// all data should be accessed via selectrs in this file
// no files outside abacus-ts should access anything within abacus-ts except this file
export const BonsaiCore = {
account: {
parentSubaccountSummary: {
data: selectParentSubaccountSummary,
loading: selectParentSubaccountSummaryLoading,
},
parentSubaccountPositions: {
data: selectParentSubaccountOpenPositions,
loading: selectParentSubaccountOpenPositionsLoading,
},
openOrders: {
data: selectOpenOrders,
loading: selectAccountOrdersLoading,
},
orderHistory: {
data: selectOrderHistory,
loading: selectAccountOrdersLoading,
},
fills: {
data: selectAccountFills,
loading: selectAccountFillsLoading,
},
},
markets: {
currentMarketId: getCurrentMarketId,
markets: {
data: selectAllMarketsInfo,
loading: selectAllMarketsInfoLoading,
},
assets: { data: selectAllAssetsInfo, loading: selectAllAssetsInfoLoading },
},
network: {
indexerHeight: {
data: selectRawIndexerHeightData,
loading: selectRawIndexerHeightDataLoading,
},
validatorHeight: {
data: selectRawValidatorHeightData,
loading: selectRawValidatorHeightDataLoading,
},
},
} as const satisfies NestedSelectors;

export const BonsaiHelpers = {
currentMarket: {
marketInfo: selectCurrentMarketInfo,
assetInfo: selectCurrentMarketAssetInfo,
account: {
openOrders: selectCurrentMarketOpenOrders,
orderHistory: selectCurrentMarketOrderHistory,
fills: getCurrentMarketAccountFills,
},
},
} as const satisfies NestedSelectors;
7 changes: 6 additions & 1 deletion src/abacus-ts/selectors/assets.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
import { createSelector } from 'reselect';

import { transformAssetsInfo } from '../calculators/assets';
import { selectRawAssetsData } from './base';
import { selectRawAssets, selectRawAssetsData } from './base';
import { selectCurrentMarketInfo } from './markets';

export const selectAllAssetsInfo = createSelector([selectRawAssetsData], (assets) =>
transformAssetsInfo(assets)
);

export const selectAllAssetsInfoLoading = createSelector(
[selectRawAssets],
(assets) => assets.status
);

export const selectCurrentMarketAssetInfo = createSelector(
[selectCurrentMarketInfo, selectAllAssetsInfo],
(currentMarketInfo, assets) => {
Expand Down
5 changes: 5 additions & 0 deletions src/abacus-ts/selectors/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export const selectRawAccountState = (state: RootState) => state.raw.account;
export const selectRawMarkets = (state: RootState) => state.raw.markets.allMarkets;
export const selectRawMarketsData = (state: RootState) => state.raw.markets.allMarkets.data;
export const selectRawAssetsData = (state: RootState) => state.raw.markets.assets.data;
export const selectRawAssets = (state: RootState) => state.raw.markets.assets;

export const selectRawParentSubaccount = (state: RootState) => state.raw.account.parentSubaccount;
export const selectRawParentSubaccountData = (state: RootState) =>
Expand All @@ -31,6 +32,10 @@ export const selectRawIndexerHeightData = (state: RootState) =>
state.raw.heights.indexerHeight.data;
export const selectRawValidatorHeightData = (state: RootState) =>
state.raw.heights.validatorHeight.data;
export const selectRawIndexerHeightDataLoading = (state: RootState) =>
state.raw.heights.indexerHeight.status;
export const selectRawValidatorHeightDataLoading = (state: RootState) =>
state.raw.heights.validatorHeight.status;

export const selectRawFillsRest = (state: RootState) => state.raw.account.fills;
export const selectRawOrdersRest = (state: RootState) => state.raw.account.orders;
Expand Down
7 changes: 6 additions & 1 deletion src/abacus-ts/selectors/markets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,17 @@ import { createAppSelector } from '@/state/appTypes';
import { getCurrentMarketId } from '@/state/perpetualsSelectors';

import { calculateAllMarkets } from '../calculators/markets';
import { selectRawMarketsData } from './base';
import { selectRawMarkets, selectRawMarketsData } from './base';

export const selectAllMarketsInfo = createAppSelector([selectRawMarketsData], (markets) =>
calculateAllMarkets(markets)
);

export const selectAllMarketsInfoLoading = createAppSelector(
[selectRawMarkets],
(markets) => markets.status
);

export const selectCurrentMarketInfo = createAppSelector(
[selectAllMarketsInfo, getCurrentMarketId],
(markets, currentMarketId) => (currentMarketId ? markets?.[currentMarketId] : undefined)
Expand Down
6 changes: 3 additions & 3 deletions src/abacus-ts/socketSelectors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import { EndpointsConfig } from '@/hooks/useEndpointsConfig';

import { type RootState } from '@/state/_store';
import { getUserSubaccountNumber, getUserWalletAddress } from '@/state/accountSelectors';
import { getUserSubaccountNumber } from '@/state/accountSelectors';
import { getSelectedNetwork } from '@/state/appSelectors';
import { createAppSelector } from '@/state/appTypes';

Expand All @@ -19,8 +19,8 @@
});

export const selectParentSubaccountInfo = createAppSelector(
[getUserWalletAddress, getUserSubaccountNumber],
(wallet, subaccount) => ({ wallet, subaccount })
[(state) => state.wallet.localWallet?.address, getUserSubaccountNumber],
(wallet, subaccount) => ({ wallet, subaccount: 0 }) // TODO DO NOT HARD CODE THIS

Check failure on line 23 in src/abacus-ts/socketSelectors.ts

View workflow job for this annotation

GitHub Actions / lint

'subaccount' is defined but never used. Allowed unused args must match /^_/u
);

export const selectIndexerReady = createAppSelector(
Expand Down
3 changes: 2 additions & 1 deletion src/components/OrderSideTag.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { IndexerOrderSide } from '@/types/indexer/indexerApiGen';
import { OrderSide } from '@dydxprotocol/v4-client-js';

import { STRING_KEYS } from '@/constants/localization';
Expand All @@ -7,7 +8,7 @@ import { useStringGetter } from '@/hooks/useStringGetter';
import { Tag, TagSign, TagSize, TagType } from './Tag';

type ElementProps = {
orderSide: OrderSide;
orderSide: OrderSide | IndexerOrderSide;
};

type StyleProps = {
Expand Down
19 changes: 19 additions & 0 deletions src/components/Table/MarketTableCell.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { AssetInfo } from '@/abacus-ts/rawTypes';

Check failure on line 1 in src/components/Table/MarketTableCell.tsx

View workflow job for this annotation

GitHub Actions / lint

'@/abacus-ts/rawTypes' import is restricted from being used by a pattern

import type { Asset } from '@/constants/abacus';

import { AssetIcon } from '@/components/AssetIcon';
Expand All @@ -22,3 +24,20 @@
</TableCell>
);
};

export const MarketTableCellNew = ({ asset }: { asset?: AssetInfo }) => {
return (
<TableCell
tw="font-bold text-color-text-2"
slotLeft={
<AssetIcon
logoUrl={asset?.logo}
symbol={asset?.id}
tw="text-[1.25rem] tablet:text-[2.25rem]"
/>
}
>
{getDisplayableAssetFromBaseAsset(asset?.id ?? '')}
</TableCell>
);
};
5 changes: 3 additions & 2 deletions src/constants/dialogs.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { ReactNode } from 'react';

import { IndexerPositionSide } from '@/types/indexer/indexerApiGen';
import { TagsOf, UnionOf, ofType, unionize } from 'unionize';

import { BigNumberish } from '@/lib/numbers';

import { AbacusPositionSides, Nullable, SubaccountOrder, SubaccountPosition } from './abacus';
import { Nullable, SubaccountOrder, SubaccountPosition } from './abacus';
import { IAffiliateStats } from './affiliates';
import { DydxChainAsset } from './wallets';

Expand Down Expand Up @@ -64,7 +65,7 @@ export type SharePNLAnalyticsDialogProps = {
oraclePrice: Nullable<number>;
entryPrice: Nullable<number>;
unrealizedPnl: Nullable<number>;
side: Nullable<AbacusPositionSides>;
side: Nullable<IndexerPositionSide>;
sideLabel: Nullable<string>;
};
export type StakeDialogProps = {};
Expand Down
6 changes: 5 additions & 1 deletion src/hooks/useAccounts.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { setOnboardingGuard, setOnboardingState } from '@/state/account';
import { getGeo, getHasSubaccount } from '@/state/accountSelectors';
import { getSelectedDydxChainId } from '@/state/appSelectors';
import { useAppDispatch, useAppSelector } from '@/state/appTypes';
import { clearSavedEncryptedSignature } from '@/state/wallet';
import { clearSavedEncryptedSignature, setLocalWallet } from '@/state/wallet';
import { getSourceAccount } from '@/state/walletSelectors';

import abacusStateManager from '@/lib/abacus';
Expand Down Expand Up @@ -135,6 +135,10 @@ const useAccountsContext = () => {
[localDydxWallet]
);

useEffect(() => {
dispatch(setLocalWallet({ address: dydxAddress }));
}, [dispatch, dydxAddress]);

const nobleAddress = useMemo(() => {
return localNobleWallet?.address;
}, [localNobleWallet]);
Expand Down
7 changes: 3 additions & 4 deletions src/hooks/useSeen.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { useEffect, useRef } from 'react';

import { selectRawIndexerHeightData } from '@/abacus-ts/selectors/base';
import { BonsaiCore } from '@/abacus-ts/ontology';
import { shallowEqual } from 'react-redux';

import { getUserWalletAddress } from '@/state/accountSelectors';
import { setSeenFills, setSeenOpenOrders, setSeenOrderHistory } from '@/state/accountUiMemory';
import { getSelectedNetwork } from '@/state/appSelectors';
import { useAppDispatch, useAppSelector } from '@/state/appTypes';
Expand All @@ -13,8 +12,8 @@ export function useViewPanel(
kind: 'fills' | 'openOrders' | 'orderHistory'
) {
const networkId = useAppSelector(getSelectedNetwork);
const walletId = useAppSelector(getUserWalletAddress);
const height = useAppSelector(selectRawIndexerHeightData);
const walletId = useAppSelector((state) => state.wallet.localWallet?.address);
const height = useAppSelector(BonsaiCore.network.indexerHeight.data);
const lastSetCore = useRef<any[]>([]);

const dispatch = useAppDispatch();
Expand Down
3 changes: 3 additions & 0 deletions src/lib/numbers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ export const MustBigNumber = (amount?: BigNumberish | null): BigNumber =>
export const MaybeBigNumber = (amount?: BigNumberish | null): BigNumber | undefined =>
amount ? MustBigNumber(amount) : undefined;

export const MaybeNumber = (amount?: BigNumberish | null): number | undefined =>
amount ? MustBigNumber(amount).toNumber() : undefined;

// doesnt allow null, always returns big number
// empty string becomes null though
export const ToBigNumber = (amount: BigNumberish): BigNumber => {
Expand Down
Loading
Loading