UNPKG

@intersect.mbo/govtool-delegation-pillar

Version:
31 lines (26 loc) 709 B
import axios from 'axios'; import { CurrentDelegation } from 'types'; import { fixViewForScriptBasedDRep } from 'utils'; export const getAdaHolderCurrentDelegation = async ({ apiUrl, stakeKey, }: { apiUrl: string; stakeKey?: string; }) => { const response = await axios.get<CurrentDelegation>( `${apiUrl}/ada-holder/get-current-delegation/${stakeKey}` ); if (!response.data) return response.data; // DBSync contains wrong representation of DRep view for script based DReps const view = response.data.dRepView && fixViewForScriptBasedDRep( response.data.dRepView, response.data.isDRepScriptBased ); return { ...response.data, dRepView: view, }; };