Skip to content
This repository was archived by the owner on Feb 12, 2026. It is now read-only.

Commit 3ee4e1c

Browse files
committed
environment data in swap demo dev tools overlay
Signed-off-by: Dominic Wörner <dom.woe@gmail.com>
1 parent 0a2431b commit 3ee4e1c

3 files changed

Lines changed: 104 additions & 7 deletions

File tree

examples/apps/staking/frontend/src/components/DeveloperOverlay.tsx

Lines changed: 81 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ import { Badge } from './ui/badge';
77
import { Input } from './ui/input';
88
import { Label } from './ui/label';
99
import { toast } from 'sonner';
10-
import { stakingVaultConfig } from '../contracts/stakingVault';
10+
import { stakingVaultConfig, STAKING_VAULT_ADDRESS } from '../contracts/stakingVault';
11+
import { VAULT_REGISTRY_ADDRESS } from '../contracts/vaultRegistry';
12+
import { ETHEREUM_CHAIN_ID, APP_GIT_COMMIT } from '../lib/env';
1113
import {
1214
Hammer,
1315
Wallet,
@@ -19,7 +21,8 @@ import {
1921
Clock,
2022
Network,
2123
Plus,
22-
DollarSign
24+
DollarSign,
25+
Server
2326
} from 'lucide-react';
2427

2528
export function DeveloperOverlay() {
@@ -388,6 +391,82 @@ export function DeveloperOverlay() {
388391
)}
389392
</div>
390393

394+
{/* Environment Status */}
395+
<div className="border-t border-slate-800 pt-4 space-y-2">
396+
<div className="flex items-center gap-2 text-slate-200 mb-2">
397+
<Server className="size-4 text-slate-400" />
398+
<span className="text-sm font-medium">Environment</span>
399+
</div>
400+
401+
<div className="space-y-1.5 text-xs">
402+
<div className="flex items-center justify-between">
403+
<span className="text-slate-500">Network:</span>
404+
<span className="font-medium text-slate-300">Chain {ETHEREUM_CHAIN_ID}</span>
405+
</div>
406+
<div className="flex items-center justify-between">
407+
<span className="text-slate-500">Staking Contract:</span>
408+
<button
409+
onClick={() => {
410+
if (STAKING_VAULT_ADDRESS && STAKING_VAULT_ADDRESS !== '0x') {
411+
navigator.clipboard?.writeText(STAKING_VAULT_ADDRESS);
412+
toast.success('Staking contract address copied!');
413+
}
414+
}}
415+
disabled={!STAKING_VAULT_ADDRESS || STAKING_VAULT_ADDRESS === '0x'}
416+
className="font-medium font-mono text-green-400 hover:text-green-300 transition-colors disabled:cursor-not-allowed disabled:hover:text-green-400"
417+
>
418+
{STAKING_VAULT_ADDRESS && STAKING_VAULT_ADDRESS !== '0x'
419+
? STAKING_VAULT_ADDRESS.slice(0, 8) + '...'
420+
: 'Not deployed'
421+
}
422+
</button>
423+
</div>
424+
<div className="flex items-center justify-between">
425+
<span className="text-slate-500">BST Token:</span>
426+
<button
427+
onClick={() => {
428+
if (bstTokenAddress && bstTokenAddress !== '0x') {
429+
navigator.clipboard?.writeText(bstTokenAddress);
430+
toast.success('BST token address copied!');
431+
}
432+
}}
433+
disabled={!bstTokenAddress || bstTokenAddress === '0x'}
434+
className="font-medium font-mono text-yellow-400 hover:text-yellow-300 transition-colors disabled:cursor-not-allowed disabled:hover:text-yellow-400"
435+
>
436+
{bstTokenAddress && bstTokenAddress !== '0x'
437+
? bstTokenAddress.slice(0, 8) + '...'
438+
: 'Loading...'
439+
}
440+
</button>
441+
</div>
442+
<div className="flex items-center justify-between">
443+
<span className="text-slate-500">Vault Registry:</span>
444+
<button
445+
onClick={() => {
446+
if (VAULT_REGISTRY_ADDRESS && VAULT_REGISTRY_ADDRESS !== '0x') {
447+
navigator.clipboard?.writeText(VAULT_REGISTRY_ADDRESS);
448+
toast.success('Vault registry address copied!');
449+
}
450+
}}
451+
disabled={!VAULT_REGISTRY_ADDRESS || VAULT_REGISTRY_ADDRESS === '0x'}
452+
className="font-medium font-mono text-purple-400 hover:text-purple-300 transition-colors disabled:cursor-not-allowed disabled:hover:text-purple-400"
453+
>
454+
{VAULT_REGISTRY_ADDRESS && VAULT_REGISTRY_ADDRESS !== '0x'
455+
? VAULT_REGISTRY_ADDRESS.slice(0, 8) + '...'
456+
: 'Not deployed'
457+
}
458+
</button>
459+
</div>
460+
<div className="flex items-center justify-between">
461+
<span className="text-slate-500">Commit:</span>
462+
<span className="font-medium font-mono text-slate-300">{APP_GIT_COMMIT}</span>
463+
</div>
464+
<div className="flex items-center justify-between">
465+
<span className="text-slate-500">Mode:</span>
466+
<span className="font-medium text-green-400">Development</span>
467+
</div>
468+
</div>
469+
</div>
391470

392471
{/* Quick Actions Footer */}
393472
<div className="border-t border-slate-800 pt-3">

examples/apps/staking/frontend/src/hooks/useStaking.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ export function useTokenBalance(address?: `0x${string}`) {
195195
* Hook to fetch user's created vaults from the IC backend
196196
*/
197197
export function useUserVaults() {
198-
const { createIdentity, createAgent } = useEthereumDerivedIdentity();
198+
const { createIdentity, createAgent } = useEthereumDerivedIdentity ();
199199
const { address: userAddress } = useAccount();
200200

201201
return useQuery<Vault[]>({

examples/apps/swap/frontend/src/components/DeveloperOverlay.tsx

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -312,21 +312,39 @@ export function DeveloperOverlay() {
312312
</div>
313313
<div className="flex items-center justify-between">
314314
<span className="text-slate-500">Swap Contract:</span>
315-
<span className="font-medium font-mono text-blue-400">
315+
<button
316+
onClick={() => {
317+
if (contracts.swapContract && contracts.swapContract !== '0x') {
318+
navigator.clipboard?.writeText(contracts.swapContract);
319+
toast.success('Swap contract address copied!');
320+
}
321+
}}
322+
disabled={!contracts.swapContract || contracts.swapContract === '0x'}
323+
className="font-medium font-mono text-blue-400 hover:text-blue-300 transition-colors disabled:cursor-not-allowed disabled:hover:text-blue-400"
324+
>
316325
{contracts.swapContract && contracts.swapContract !== '0x'
317326
? contracts.swapContract.slice(0, 8) + '...'
318327
: 'Not deployed'
319328
}
320-
</span>
329+
</button>
321330
</div>
322331
<div className="flex items-center justify-between">
323332
<span className="text-slate-500">Vault Registry:</span>
324-
<span className="font-medium font-mono text-purple-400">
333+
<button
334+
onClick={() => {
335+
if (contracts.vaultRegistry && contracts.vaultRegistry !== '0x') {
336+
navigator.clipboard?.writeText(contracts.vaultRegistry);
337+
toast.success('Vault registry address copied!');
338+
}
339+
}}
340+
disabled={!contracts.vaultRegistry || contracts.vaultRegistry === '0x'}
341+
className="font-medium font-mono text-purple-400 hover:text-purple-300 transition-colors disabled:cursor-not-allowed disabled:hover:text-purple-400"
342+
>
325343
{contracts.vaultRegistry && contracts.vaultRegistry !== '0x'
326344
? contracts.vaultRegistry.slice(0, 8) + '...'
327345
: 'Not deployed'
328346
}
329-
</span>
347+
</button>
330348
</div>
331349
<div className="flex items-center justify-between">
332350
<span className="text-slate-500">Commit:</span>

0 commit comments

Comments
 (0)