export type GetUidProofFromWallet = {
  polyWallet: any;
  ticker: string;
  errorHandler?: (error: Error) => void;
};

export const getUidProofFromWallet = ({
  polyWallet,
  ticker,
  errorHandler,
}: GetUidProofFromWallet): any | null =>
  polyWallet.uid
    .requestProof({ ticker })
    .then((data: any) => {
      return data.proof;
    })
    .catch((error: Error) => {
      if (errorHandler) errorHandler(error);
      return null;
    });
