export type ApiJettonVerification = 'BLACKLISTED' | 'UNKNOWN' | 'COMMUNITY' | 'WHITELISTED'; export type ApiJettonImportRequest = {address: string, verification?: ApiJettonVerification | undefined}; export type CreateApiApiV3JettonsImportArgs = {body: ApiJettonImportRequest}; export type CreateApiApiV3JettonsImportOptions = {baseUrl?: string | undefined, ApiKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Import a jetton. If no verification is provided, the jetton will be marked according to our own whitelist. * * POST /api/v3/jettons/import */ export const createApiApiV3JettonsImport = async (args: CreateApiApiV3JettonsImportArgs, options?: CreateApiApiV3JettonsImportOptions) => { const {baseUrl = "https://tokens.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(/\/+$/, '')}/api/v3/jettons/import${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 };