Skip to content

Commit

Permalink
Use union type instead of enum for ExplorerDataType
Browse files Browse the repository at this point in the history
  • Loading branch information
kkosiorowska committed Jan 19, 2024
1 parent 6da5a2a commit 1eae36a
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from "react"
import { Chain, ExplorerDataType } from "#/types"
import { Chain } from "#/types"
import { BLOCK_EXPLORER } from "#/constants"
import ViewInBlockExplorer from "#/components/shared/ViewInBlockExplorer"
import SimpleText from "./SimpleText"
Expand All @@ -9,7 +9,7 @@ function BlockExplorer({ txHash, chain }: { txHash?: string; chain: Chain }) {
return (
<ViewInBlockExplorer
id={txHash}
type={ExplorerDataType.TRANSACTION}
type="transaction"
chain={chain}
size="sm"
/>
Expand Down
4 changes: 1 addition & 3 deletions dapp/src/types/chain.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
export type Chain = "bitcoin" | "ethereum"

export enum ExplorerDataType {
TRANSACTION = "transaction",
}
export type ExplorerDataType = "transaction"
2 changes: 1 addition & 1 deletion dapp/src/utils/chain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export const createBlockExplorerLink = (
type: ExplorerDataType,
) => {
switch (type) {
case ExplorerDataType.TRANSACTION:
case "transaction":
default: {
return `${prefix}/tx/${id}`
}
Expand Down

0 comments on commit 1eae36a

Please sign in to comment.