export type RespondToConnectionRequest = {approve: boolean}; export type UpdateApiConnectionsWcIdArgs = {id: string, 'Idempotency-Key'?: string | undefined, 'X-End-User-Wallet-Id'?: string | undefined, body: RespondToConnectionRequest}; export type UpdateApiConnectionsWcIdOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Respond to a pending Web3 connection request. * * PUT /connections/wc/{id} */ export const updateApiConnectionsWcId = async (args: UpdateApiConnectionsWcIdArgs, options?: UpdateApiConnectionsWcIdOptions) => { const {baseUrl = "https://api.fireblocks.io/v1", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (args['Idempotency-Key'] != null) headers.set("Idempotency-Key", String(args['Idempotency-Key'])) if (args['X-End-User-Wallet-Id'] != null) headers.set("X-End-User-Wallet-Id", String(args['X-End-User-Wallet-Id'])) const url = `${baseUrl.replace(/\/+$/, '')}/connections/wc/${encodeURIComponent(String(args.id))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PUT", 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 };