export type ApiTransactionsCustomFee = {fixed_fee?: string | undefined, percentage_fee?: number | undefined, min_percentage_fee_fixed?: string | undefined, max_percentage_fee_fixed?: string | undefined}; export type ApiPartnerSettings = {ref_share: number, custom_fee: ApiTransactionsCustomFee}; export type CreateApiV1PartnershipAddressSettingsArgs = {address: string, body: ApiPartnerSettings}; export type CreateApiV1PartnershipAddressSettingsOptions = {baseUrl?: string | undefined, ApiKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Set partner settings. For internal usage only * * POST /v1/partnership/{address}/settings */ export const createApiV1PartnershipAddressSettings = async (args: CreateApiV1PartnershipAddressSettingsArgs, options?: CreateApiV1PartnershipAddressSettingsOptions) => { 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/partnership/${encodeURIComponent(String(args.address))}/settings${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 };