diff --git a/src/lib/market/index.ts b/src/lib/market/index.ts index c94bd7f..547e888 100644 --- a/src/lib/market/index.ts +++ b/src/lib/market/index.ts @@ -9,7 +9,14 @@ import { resolveAssetId, toLockerGridItems, } from "@/lib/locker"; -import { applyTransaction, ensurePersonalAccount, getMainCurrencyId } from "@/lib/banking"; +import { + applyTransaction, + ensurePersonalAccount, + getMainCurrencyId, + getTreasuryAccountId, +} from "@/lib/banking"; + +export { getTreasuryAccountId } from "@/lib/banking"; type PayloadType = Awaited>; @@ -218,22 +225,6 @@ export async function creditLockerQuantity( })) as unknown as LockerStorage; } -/** Resolve the id of the open unit treasury account, if any. */ -export async function getTreasuryAccountId(payload: PayloadType): Promise { - try { - const result = (await payload.find({ - collection: "bank-accounts", - where: { and: [{ accountType: { equals: "treasury" } }, { status: { equals: "open" } }] }, - limit: 1, - depth: 0, - overrideAccess: true, - })) as unknown as { docs: { id: number }[] }; - return result.docs[0]?.id ?? null; - } catch { - return null; - } -} - export interface BuyResult { transactionId: number; total: number;