export type SNWalletAmount = {assetType: string, quantity: string, walletId?: string | undefined}; export type SNAcceptSettlementRequest = {useGasStation?: boolean | undefined, vaultId: string, walletAmounts: Array}; export type CreateApiAtlasSettlementsSettlementIdAcceptArgs = {settlementId: string, 'Api-Signature': string, 'Api-Timestamp': number, body: SNAcceptSettlementRequest}; export type CreateApiAtlasSettlementsSettlementIdAcceptOptions = {baseUrl?: string | undefined, ApiAccessKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Accept a settlement * * POST /atlas/settlements/{settlementId}/accept */ export const createApiAtlasSettlementsSettlementIdAccept = async (args: CreateApiAtlasSettlementsSettlementIdAcceptArgs, options?: CreateApiAtlasSettlementsSettlementIdAcceptOptions) => { const {baseUrl = "https://api.anchorage-staging.com/v2", fetch: fetchFn = fetch, ApiAccessKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (args['Api-Signature'] != null) headers.set("Api-Signature", String(args['Api-Signature'])) if (args['Api-Timestamp'] != null) headers.set("Api-Timestamp", String(args['Api-Timestamp'])) if (ApiAccessKey !== undefined) headers.set("Api-Access-Key", ApiAccessKey) const url = `${baseUrl.replace(/\/+$/, '')}/atlas/settlements/${encodeURIComponent(String(args.settlementId))}/accept${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 };