export type ApiStrategyWalletPayoutEntry = {token: string, amount: string}; export type ApiStrategyWalletPayout = {address: string, entries: Array}; export type CreateApiV1StrategiesWalletPayoutArgs = {body: ApiStrategyWalletPayout}; export type CreateApiV1StrategiesWalletPayoutOptions = {baseUrl?: string | undefined, ApiKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Make a payout from strategy wallet to wallet's owner. For internal usage only. * * POST /v1/strategies/wallet/payout */ export const createApiV1StrategiesWalletPayout = async (args: CreateApiV1StrategiesWalletPayoutArgs, options?: CreateApiV1StrategiesWalletPayoutOptions) => { const {baseUrl = "https://backend.swap.coffee", fetch: fetchFn = fetch, ApiKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (ApiKey !== undefined) headers.set("X-Api-Key", ApiKey) const url = `${baseUrl.replace(/\/+$/, '')}/v1/strategies/wallet/payout${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", 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 };