// SPDX-FileCopyrightText: © 2024 LEDGER SAS // SPDX-License-Identifier: Apache-2.0 import type { Balance, BalanceOptions } from '../types' import { InvalidParameterError } from '../../errors' /** * Wraps a balance fetcher that does not support {@link BalanceOptions} * * @param getBalance function that returns {@link Balance}[] without applying options * @param options must be undefined; any defined value is rejected * @returns the promise returned by {@link getBalance} * @throws an {@link InvalidParameterError} when {@link options} is provided */ export async function rejectBalanceOptions( getBalance: () => Promise, options?: BalanceOptions ): Promise { if (options) { throw new InvalidParameterError('getBalance does not support the options parameter') } return getBalance() }