export type ApiFundFee = {fee_bps: number, fee_type: string, recipient: string}; export type ApiUpdateFundFeesSettings = {fees: Array}; export type ApiConstraintType = 'MaxPercentage' | 'MaxBaseAssetAmount'; export type ApiYieldSourceTarget = {protocol: string, yield_source_type: string}; export type ApiFundConstraint = {constraint_type: ApiConstraintType, value: number, yield_source_target: ApiYieldSourceTarget}; export type ApiUpdateFundConstraintsSettings = {constraints?: (Array | null) | undefined, risk_aversion_bps?: (number | null) | undefined, risk_max?: (number | null) | undefined}; export type ApiUpdateFundRebalanceSettings = {min_position_settle_time?: (number | null) | undefined, min_rebalance_value?: (number | null) | undefined, rebalance_period?: (number | null) | undefined, unallocated_threshold?: (number | null) | undefined}; export type ApiUpdateFundAdminRequest = {delegated_withdrawer?: (string | null) | undefined, fees_settings?: (ApiUpdateFundFeesSettings | null) | undefined, fund_settings?: (ApiUpdateFundConstraintsSettings | null) | undefined, rebalance_settings?: (ApiUpdateFundRebalanceSettings | null) | undefined}; export type UpdateApiAdminFundsFundIdArgs = {fund_id: string, body: ApiUpdateFundAdminRequest}; export type UpdateApiAdminFundsFundIdOptions = {baseUrl?: string | undefined, bearerAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * PUT /admin/funds/{fund_id} */ export const updateApiAdminFundsFundId = async (args: UpdateApiAdminFundsFundIdArgs, options?: UpdateApiAdminFundsFundIdOptions) => { const {baseUrl = "https://api.breeze.baby", fetch: fetchFn = fetch, bearerAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (bearerAuth !== undefined) headers.set('authorization', `Bearer ${bearerAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/admin/funds/${encodeURIComponent(String(args.fund_id))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PUT", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };