export type GetApiV4KyaScreeningArgs = {chain: string, address: string}; export type GetApiV4KyaScreeningOptions = {baseUrl: string, ApiKeyAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Get Address Screening Information * * GET /v4/kya/screening * * Also accepts auth: ApiSecretAuth */ export const getApiV4KyaScreening = async (args: GetApiV4KyaScreeningArgs, options: GetApiV4KyaScreeningOptions) => { const {baseUrl, fetch: fetchFn = fetch, ApiKeyAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.chain != null) query.append("chain", String(args.chain)) if (args.address != null) query.append("address", String(args.address)) if (ApiKeyAuth !== undefined) headers.set("X-API-Key", ApiKeyAuth) const url = `${baseUrl.replace(/\/+$/, '')}/v4/kya/screening${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "GET", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };