export type FeeLevel = 'LOW' | 'MEDIUM' | 'HIGH'; export type ClaimRewardsRequest = {id: string, fee?: string | undefined, feeLevel?: FeeLevel | undefined, txNote?: string | undefined}; export type CreateApiStakingChainsChainDescriptorClaimRewardsArgs = {chainDescriptor: 'SOL' | 'SOL_TEST' | 'MATIC' | 'POL' | 'POL_TEST', 'Idempotency-Key'?: string | undefined, body: ClaimRewardsRequest}; export type CreateApiStakingChainsChainDescriptorClaimRewardsOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Claim accrued rewards * * POST /staking/chains/{chainDescriptor}/claim_rewards */ export const createApiStakingChainsChainDescriptorClaimRewards = async (args: CreateApiStakingChainsChainDescriptorClaimRewardsArgs, options?: CreateApiStakingChainsChainDescriptorClaimRewardsOptions) => { 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'])) const url = `${baseUrl.replace(/\/+$/, '')}/staking/chains/${encodeURIComponent(String(args.chainDescriptor))}/claim_rewards${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 };