vega-frontend-monorepo/libs/accounts/src/lib/get-settlement-account.ts
botond 2211abbd72
chore: cleanup type gen (#2362)
* chore: remove apollo type gen and clean up types lib

* fix: format

* fix: tests

* fix: format

* fix: hammer token types til sh*t turns green

* fix: format

* fix: apparently format again

* fix: lint

* fix: build-specs

* fix: format

* chore: regen types

* chore: regenerate types again

* fix: format
2022-12-08 21:13:30 +00:00

16 lines
412 B
TypeScript

import type { Account } from './accounts-data-provider';
import * as Schema from '@vegaprotocol/types';
interface Props {
accounts: Account[] | null;
assetId: string;
}
export const getSettlementAccount = ({ accounts, assetId }: Props) =>
accounts?.find((account) => {
return (
account.asset.id === assetId &&
account.type === Schema.AccountType.ACCOUNT_TYPE_GENERAL
);
}) || null;