export type NearToEthTransfer = {chainId?: string | undefined, bridgeTokenContract: string, sender: string, recipient: string, amount: unknown}; export type CreateApiNearNftBridgeTokensWithdrawArgs = {'x-near-signature'?: string | undefined, body: NearToEthTransfer}; export type CreateApiNearNftBridgeTokensWithdrawOptions = {baseUrl?: string | undefined, apiKey?: string | undefined, authenticatedEncryption?: string | undefined, ethereum?: string | undefined, collabLandOAuth2?: string | undefined, fetch?: typeof fetch | undefined}; /** * POST /near-nft/bridge-tokens/withdraw */ export const createApiNearNftBridgeTokensWithdraw = async (args: CreateApiNearNftBridgeTokensWithdrawArgs, options?: CreateApiNearNftBridgeTokensWithdrawOptions) => { const {baseUrl = "https://api.collab.land", fetch: fetchFn = fetch, apiKey, authenticatedEncryption, ethereum, collabLandOAuth2} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (args['x-near-signature'] != null) headers.set("x-near-signature", String(args['x-near-signature'])) if (apiKey !== undefined) headers.set("x-api-key", apiKey) if (authenticatedEncryption !== undefined) headers.set("Authorization", authenticatedEncryption) if (ethereum !== undefined) headers.set("Authorization", ethereum) if (collabLandOAuth2 !== undefined) headers.set('authorization', `Bearer ${collabLandOAuth2}`) const url = `${baseUrl.replace(/\/+$/, '')}/near-nft/bridge-tokens/withdraw${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 };