Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix portal time & nft error #1761

Merged
merged 1 commit into from
May 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions infra/rooch-portal/.env.production
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
VITE_ROOCH_OPERATING_ADDRESS=0xb7ac336861ff431cf867400a1eaa9708b5666954b5268486e6bd2e948aab1a42
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ import {
} from '@roochnetwork/rooch-sdk-kit'
import { Copy, ChevronDown, ChevronUp, Check, AlertCircle } from 'lucide-react'

import {formatTimestamp} from '@/utils/format.ts'

interface Session {
authenticationKey: string
appName: string
Expand All @@ -41,11 +43,6 @@ interface ExpandableRowProps {
remove: (authKey: string) => void
}

const formatTimestamp = (timestamp: number): string => {
const date = new Date(timestamp)
return date.toLocaleString()
}

const copyToClipboard = async (text: string, setCopied: (value: boolean) => void) => {
try {
await navigator.clipboard.writeText(text)
Expand Down Expand Up @@ -116,6 +113,8 @@ export const ManageSessions: React.FC = () => {
)
}

console.log(sessionKeys)

return (
<div className="rounded-lg border w-full">
<Table>
Expand Down
8 changes: 8 additions & 0 deletions infra/rooch-portal/src/utils/format.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@

import { PaymentTypes } from '@/common/interface'

export const formatTimestamp = (timestamp: number): string => {
if (timestamp < 1e10) {
timestamp *= 1000
}
const date = new Date(timestamp);
return date.toLocaleString();
}

export const formatCoin = (balance: number, decimals: number, precision = 2) => {
const divisor = Math.pow(10, decimals)
return (balance / divisor).toFixed(precision)
Expand Down
Loading