kodadot/nft-gallery

View on GitHub
utils/historyEvent.ts

Summary

Maintainability
A
0 mins
Test Coverage
import { Interaction } from '@kodadot1/minimark/v1'
import formatBalance from '@/utils/format/balance'

enum SpecialHistoryEventType {
  ALL = 'ALL',
}

export enum InteractionBsxOnly {
  ROYALTY = 'ROYALTY',
  PAY_ROYALTY = 'PAY_ROYALTY',
}
export type HistoryEventType =
  | Interaction
  | SpecialHistoryEventType
  | InteractionBsxOnly
export const HistoryEventType = {
  ...InteractionBsxOnly,
  ...SpecialHistoryEventType,
  ...Interaction,
}

export const parseChartAmount = (amount: string, decimals: number): number => {
  return parseFloat(formatBalance(amount, decimals))
}