Skip to content
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
15 changes: 10 additions & 5 deletions apps/leaderboard/netlify.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,13 @@
publish = "dist/apps/leaderboard"
command = "yarn nx build leaderboard"

# If the branch is not master, continue the build process
# If the branch is master, check if the project's CHANGELOG.md file has changed
# If the CHANGELOG.md file has changed, continue the build process,
# Otherwise, stop the build process
ignore = "[ \"$BRANCH\" != \"master\" ] && exit 1 || git diff --quiet $CACHED_COMMIT_REF $COMMIT_REF -- apps/leaderboard/CHANGELOG.md && exit 0 || exit 1"
# Trigger a master deploy whenever the app's own source, the shared
# libs it consumes, or the workspace dep manifest changes. The previous
# version gated on apps/leaderboard/CHANGELOG.md only, which silently
# cancelled every push that wasn't a release-PR — leaderboard had
# never deployed before we caught it. CHANGELOG.md is now implicitly
# covered (it's inside apps/leaderboard/), and any source/config/
# lockfile change also re-triggers.
#
# Non-master branches always build (gives PR-preview deploys).
ignore = "[ \"$BRANCH\" != \"master\" ] && exit 1 || git diff --quiet $CACHED_COMMIT_REF $COMMIT_REF -- apps/leaderboard/ libs/ package.json yarn.lock tsconfig.base.json nx.json && exit 0 || exit 1"
17 changes: 11 additions & 6 deletions apps/tangle-cloud/netlify.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,17 @@
publish = "dist/apps/tangle-cloud"
command = "yarn nx build tangle-cloud"

# Trigger a master deploy whenever the app's own source, the shared
# libs it consumes, or the workspace dep manifest changes. The previous
# version gated on apps/tangle-cloud/CHANGELOG.md only, which silently
# cancelled every push that wasn't a release-PR — a year of overhaul
# work piled up un-deployed before we caught it. CHANGELOG.md is now
# implicitly covered (it's inside apps/tangle-cloud/), and any source/
# config/lockfile change also re-triggers.
#
# Non-master branches always build (gives PR-preview deploys).
ignore = "[ \"$BRANCH\" != \"master\" ] && exit 1 || git diff --quiet $CACHED_COMMIT_REF $COMMIT_REF -- apps/tangle-cloud/ libs/ package.json yarn.lock tsconfig.base.json nx.json && exit 0 || exit 1"

# ─── Per-context environment ───────────────────────────────────────────
#
# Vite reads VITE_* vars at build time and inlines them into the bundle,
Expand All @@ -28,12 +39,6 @@
# Same default for any non-master branch deploy (e.g. staging).
VITE_BLUEPRINT_IFRAME_ENABLED = "true"

# If the branch is not master, continue the build process
# If the branch is master, check if the project's CHANGELOG.md file has changed
# If the CHANGELOG.md file has changed, continue the build process,
# Otherwise, stop the build process
ignore = "[ \"$BRANCH\" != \"master\" ] && exit 1 || git diff --quiet $CACHED_COMMIT_REF $COMMIT_REF -- apps/tangle-cloud/CHANGELOG.md && exit 0 || exit 1"

# ─── Security headers ───────────────────────────────────────────────────
#
# Scope is intentionally narrow: we set ONLY the headers needed to harden
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { FC } from 'react';
import { isEthereumAddress } from '@polkadot/util-crypto';
import { isAddress } from 'viem';
import { twMerge } from 'tailwind-merge';
import { Text } from '../sandbox/SandboxUi';

Expand All @@ -25,7 +25,7 @@ const BlueprintInfoCard: FC<Props> = ({
instancesCount,
operatorsCount,
}) => {
const formattedAuthor = isEthereumAddress(author)
const formattedAuthor = isAddress(author, { strict: false })
? shortenValue(author)
: author.length > 24
? shortenValue(author)
Expand Down
9 changes: 4 additions & 5 deletions apps/tangle-cloud/src/components/TxHistoryDrawer.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { BN } from '@polkadot/util';
import * as Dialog from '@radix-ui/react-dialog';
import {
CheckboxCircleLine,
Expand Down Expand Up @@ -30,7 +29,7 @@ const shortenHex = (value: string) =>
value.length > 14 ? `${value.slice(0, 8)}...${value.slice(-6)}` : value;
const shortenString = (value: string) =>
value.length > 14 ? `${value.slice(0, 8)}...${value.slice(-6)}` : value;
const formatDisplayAmount = (value: BN | bigint, decimals: number) => {
const formatDisplayAmount = (value: bigint, decimals: number) => {
const raw = value.toString();
if (decimals <= 0) return addCommasToNumber(Number(raw));
const padded = raw.padStart(decimals + 1, '0');
Expand Down Expand Up @@ -203,7 +202,7 @@ const DetailRow: FC<DetailRowProps> = ({
if (typeof value === 'number') {
if (isAmountKey) {
const decimals = tokenMetadata?.decimals ?? 18;
const formatted = formatDisplayAmount(new BN(value), decimals);
const formatted = formatDisplayAmount(BigInt(value), decimals);
if (isSharesKey) {
return formatted;
}
Expand All @@ -224,7 +223,7 @@ const DetailRow: FC<DetailRowProps> = ({
if (typeof value === 'string') {
if (isAmountKey && isNumericString(value)) {
const decimals = tokenMetadata?.decimals ?? 18;
const formatted = formatDisplayAmount(new BN(value), decimals);
const formatted = formatDisplayAmount(BigInt(value), decimals);
if (isSharesKey) {
return formatted;
}
Expand All @@ -244,7 +243,7 @@ const DetailRow: FC<DetailRowProps> = ({
}, [value, isAmountKey, isSharesKey, tokenMetadata, nativeTokenSymbol]);

const rawValue = useMemo(() => {
if (BN.isBN(value)) {
if (typeof value === 'bigint') {
return value.toString();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,20 @@ import type {
} from '../../../components/tangleCloudTable/type';
import { Link } from 'react-router';
import { TangleDAppPagePath } from '../../../types';
import type { BN } from '@polkadot/util';

const toBigInt = (value: bigint | BN): bigint =>
// Locally typed to avoid pulling in `@polkadot/util` for a type-only reference.
// The shared `StakingVault` shape uses BN for some amount fields; we only ever
// call `.toString()` on them, so a structural type is sufficient.
type BigIntish = bigint | { toString(): string };

const toBigInt = (value: BigIntish): bigint =>
typeof value === 'bigint' ? value : BigInt(value.toString());
const pluralize = (word: string, plural: boolean) =>
plural ? `${word}s` : word;
const formatPercentage = (value: number) =>
`${(value * 100).toLocaleString(undefined, { maximumFractionDigits: 2 })}%`;

const formatAmount = (amount: bigint | BN, decimals: number): string => {
const formatAmount = (amount: BigIntish, decimals: number): string => {
const formatted = formatUnits(toBigInt(amount), decimals);
const num = parseFloat(formatted);
if (num === 0) return '0';
Expand All @@ -46,7 +50,7 @@ const formatAmount = (amount: bigint | BN, decimals: number): string => {
});
};

const calculateRatio = (a: bigint | BN, b: bigint | BN): number => {
const calculateRatio = (a: BigIntish, b: BigIntish): number => {
const aBigInt = toBigInt(a);
const bBigInt = toBigInt(b);
if (bBigInt === BigInt(0)) return 0;
Expand Down
7 changes: 3 additions & 4 deletions apps/tangle-cloud/src/pages/rewards/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import {
TableHeader,
TableRow,
} from '@tangle-network/sandbox-ui/primitives';
import { BN } from '@polkadot/util';
import {
ExternalLinkLine,
FileCopyLine,
Expand Down Expand Up @@ -59,7 +58,7 @@ const shortenHex = (value: string, chars = 6) =>
? `${value.slice(0, chars)}...${value.slice(-chars)}`
: value;

const formatDisplayAmount = (value: BN, decimals: number) => {
const formatDisplayAmount = (value: bigint, decimals: number) => {
const raw = value.toString();
const padded = raw.padStart(decimals + 1, '0');
const whole = padded.slice(0, -decimals);
Expand Down Expand Up @@ -737,7 +736,7 @@ const PendingRewardAmountCell: FC<{ token: Address; amount: bigint }> = ({

return (
<span className="font-semibold text-foreground text-sm">
{formatDisplayAmount(new BN(amount.toString()), decimals)}
{formatDisplayAmount(amount, decimals)}
</span>
);
};
Expand All @@ -759,7 +758,7 @@ const RewardAmountCell: FC<{ token: Address; amount: bigint }> = ({

return (
<span className="font-semibold text-foreground text-sm">
{formatDisplayAmount(new BN(amount.toString()), decimals)}
{formatDisplayAmount(amount, decimals)}
</span>
);
};
Expand Down
15 changes: 10 additions & 5 deletions apps/tangle-dapp/netlify.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,16 @@
publish = "dist/apps/tangle-dapp"
command = "yarn nx build tangle-dapp"

# If the branch is not master, continue the build process
# If the branch is master, check if the project's CHANGELOG.md file has changed
# If the CHANGELOG.md file has changed, continue the build process,
# Otherwise, stop the build process
ignore = "[ \"$BRANCH\" != \"master\" ] && exit 1 || git diff --quiet $CACHED_COMMIT_REF $COMMIT_REF -- apps/tangle-dapp/CHANGELOG.md && exit 0 || exit 1"
# Trigger a master deploy whenever the app's own source, the shared
# libs it consumes, or the workspace dep manifest changes. The previous
# version gated on apps/tangle-dapp/CHANGELOG.md only, which silently
# cancelled every push that wasn't a release-PR — production was stuck
# on the August 2025 release until we caught it. CHANGELOG.md is now
# implicitly covered (it's inside apps/tangle-dapp/), and any source/
# config/lockfile change also re-triggers.
#
# Non-master branches always build (gives PR-preview deploys).
ignore = "[ \"$BRANCH\" != \"master\" ] && exit 1 || git diff --quiet $CACHED_COMMIT_REF $COMMIT_REF -- apps/tangle-dapp/ libs/ package.json yarn.lock tsconfig.base.json nx.json && exit 0 || exit 1"

# ─── Cache headers ──────────────────────────────────────────────────────
#
Expand Down
Loading