Skip to content
Open
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
2 changes: 1 addition & 1 deletion apps/web/src/utils/basenames/getDomain.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { isDevelopment } from 'apps/web/src/constants';
import { NextRequest } from 'next/server';

export function getDomain(request: NextRequest) {
export function getDomain(request: NextRequest): string {
return isDevelopment
? `${request.nextUrl.protocol}//${request.nextUrl.host}`
: 'https://www.base.org';
Expand Down
1 change: 0 additions & 1 deletion apps/web/src/utils/bugsnag.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// import React from 'react';
import type { BugsnagPluginReactResult } from '@bugsnag/plugin-react';
import type { OnErrorCallback } from '@bugsnag/core/types/common';

Expand Down
6 changes: 3 additions & 3 deletions apps/web/src/utils/formatEtherPrice.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { formatEther } from 'viem';

export function formatEtherPrice(price?: bigint) {
if (price === undefined) {
export function formatEtherPrice(price?: bigint): number | '...' {
if (!Boolean(price)) {
return '...';
}
const value = parseFloat(formatEther(price));
const value: number = parseFloat(formatEther(price));
if (value < 0.001) {
return parseFloat(value.toFixed(4));
} else {
Expand Down
5 changes: 2 additions & 3 deletions apps/web/src/utils/formatUsdPrice.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { formatEther } from 'viem';

export function formatUsdPrice(price: bigint, ethUsdPrice: number) {
export function formatUsdPrice(price: bigint, ethUsdPrice: number): string {
if (price === 0n) return '0';
const parsed = (parseFloat(formatEther(price)) * Number(ethUsdPrice)).toFixed(2);
if (parsed === '0.00') return '0';
return parsed;
return parsed === '0.00' ? '0' : parsed;
}
2 changes: 1 addition & 1 deletion apps/web/src/utils/formatWei.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { formatEther, parseEther } from 'viem';

export function formatWei(wei?: bigint): bigint | '...' {
if (wei === undefined) {
if (!Boolean(wei)) {
return '...';
}

Expand Down
4 changes: 2 additions & 2 deletions apps/web/src/utils/logEvent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ declare const window: Window &
};
};

export default function logEvent(name: string, event: unknown) {
export default function logEvent(name: string, event: unknown): void {
if (window.ClientAnalytics) {
window.ClientAnalytics?.logEvent(name, event);
}
}

export function identify(event: unknown) {
export function identify(event: unknown): void {
if (window.ClientAnalytics) {
window.ClientAnalytics?.logEvent('identify', event);
}
Expand Down
4 changes: 2 additions & 2 deletions apps/web/src/utils/weiToEth.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { formatEther } from 'viem';

export function weiToEth(wei?: bigint): number | '...' {
if (wei === undefined) {
if (!Boolean(wei)) {
return '...';
}
const eth = parseFloat(formatEther(wei));
const eth: number = parseFloat(formatEther(wei));
if (eth < 0.001) {
return parseFloat(eth.toFixed(4));
} else {
Expand Down