Skip to content

Commit 13ee6c5

Browse files
committed
デュアルネットワークUI実装
UI追加: - 2つのデモボタン 1. Start Demo (Fuji) - Avalanche、Phase 1 2. EIP-7702 Demo (Sepolia) - EIP-7702完全実装 - ネットワーク状態管理 - network.ts: ネットワーク設定型定義 次のステップ: - ネットワーク切り替えロジック実装 - Sepolia版テスト実行 - 両方の動作確認
1 parent 27de347 commit 13ee6c5

2 files changed

Lines changed: 72 additions & 7 deletions

File tree

src/app/agent/page.tsx

Lines changed: 29 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ export default function AgentDashboard() {
2626

2727
const [demoStep, setDemoStep] = useState<string>('ready');
2828
const [negotiationResult, setNegotiationResult] = useState<any>(null);
29+
const [selectedNetwork, setSelectedNetwork] = useState<'fuji' | 'sepolia'>('fuji');
2930

3031
// JPYC残高をリアルタイム更新
3132
const [agentBalances, setAgentBalances] = useState<Record<string, string>>({});
@@ -149,12 +150,20 @@ export default function AgentDashboard() {
149150
});
150151
};
151152

152-
// フルデモシナリオ実行
153-
const handleStartFullDemo = async () => {
154-
console.log('[Dashboard] Starting full demo scenario...');
153+
// フルデモシナリオ実行(Avalanche Fuji)
154+
const handleStartFujiDemo = async () => {
155+
console.log('[Dashboard] Starting Fuji demo (Phase 1)...');
156+
setSelectedNetwork('fuji');
155157
setDemoStep('running');
156-
157-
// シミュレーション開始(2秒後にコリジョン発生)
158+
await simulation.start();
159+
};
160+
161+
// Sepoliaデモ実行(EIP-7702完全実装)
162+
const handleStartSepoliaDemo = async () => {
163+
console.log('[Dashboard] Starting Sepolia demo (Phase 2 - EIP-7702)...');
164+
setSelectedNetwork('sepolia');
165+
setDemoStep('running');
166+
// TODO: Sepolia用のsimulation実装
158167
await simulation.start();
159168
};
160169

@@ -198,15 +207,28 @@ export default function AgentDashboard() {
198207

199208
{/* コントロールボタン */}
200209
<div className="ml-auto flex items-center gap-2">
210+
{/* Fujiデモボタン */}
201211
<Button
202212
variant="primary"
203213
size="sm"
204-
onClick={handleStartFullDemo}
214+
onClick={handleStartFujiDemo}
205215
disabled={simulation.isRunning || simulation.isLoading}
206216
>
207217
<Play className="w-4 h-4 mr-2" />
208-
Start Full Demo
218+
Start Demo (Fuji)
209219
</Button>
220+
221+
{/* Sepoliaデモボタン */}
222+
<Button
223+
variant="secondary"
224+
size="sm"
225+
onClick={handleStartSepoliaDemo}
226+
disabled={simulation.isRunning || simulation.isLoading}
227+
>
228+
<Zap className="w-4 h-4 mr-2" />
229+
EIP-7702 Demo (Sepolia)
230+
</Button>
231+
210232
<Button
211233
variant="ghost"
212234
size="sm"

src/types/network.ts

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
/**
2+
* ネットワーク設定の型定義
3+
*/
4+
5+
export type Network = 'fuji' | 'sepolia';
6+
7+
export interface NetworkConfig {
8+
name: string;
9+
displayName: string;
10+
chainId: number;
11+
rpcUrl: string;
12+
explorerUrl: string;
13+
jpycContract: string;
14+
agentRegistry: string;
15+
trafficContract: string;
16+
supportsEIP7702: boolean;
17+
}
18+
19+
export const NETWORK_CONFIGS: Record<Network, NetworkConfig> = {
20+
fuji: {
21+
name: 'fuji',
22+
displayName: 'Avalanche Fuji',
23+
chainId: 43113,
24+
rpcUrl: 'https://api.avax-test.network/ext/bc/C/rpc',
25+
explorerUrl: 'https://testnet.snowtrace.io',
26+
jpycContract: '0xE50b2A73eCf5D93D1c885C2F676f8921F3CaCdcd',
27+
agentRegistry: '0xD41DBe68a4aBe9CcA352400Ba1240E27865cD1c1',
28+
trafficContract: '0xC196330F11B18973274419E7Fa2cf954Aff98BE8',
29+
supportsEIP7702: false,
30+
},
31+
sepolia: {
32+
name: 'sepolia',
33+
displayName: 'Ethereum Sepolia',
34+
chainId: 11155111,
35+
rpcUrl: 'https://ethereum-sepolia-rpc.publicnode.com',
36+
explorerUrl: 'https://sepolia.etherscan.io',
37+
jpycContract: '0x48EDb73F9C584A38Da43A6Ec9F39eF6D14E4A557',
38+
agentRegistry: '0x169d90cE2A7ccbF67e1B20752339eBc1a068dbb3',
39+
trafficContract: '0x1a61a82Ab9874FFFBE9aC6F00479d5c8ae2EC142',
40+
supportsEIP7702: true,
41+
},
42+
};
43+

0 commit comments

Comments
 (0)