Sui.

Bài viết

Chia sẻ kiến thức của bạn.

harry phan.
Jul 12, 2025
Thảo Luận

Xây dựng bảng điều khiển Walrus

Tôi tìm thấy bài đăng từ https://x.com/Reset_sui/status/1944003777457271197

Tạo bảng điều khiển Walrus hiển thị: -Chi phí lưu trữ/ghi trên mỗi kỳ/ngày/năm (GB/TB) -Doanh thu hàng ngày/hàng năm & thanh toán nút lưu trữ Chuyển đổi -USD để so sánh với các nhà cung cấp khác

Liên kết: http://walytics.wal.app

Link

  • Sui
1
2
Chia sẻ
Bình luận
.

Câu trả lời

2
MoonBags.
Jul 14 2025, 03:19

Tôi đang sử dụng TypeScript SDK (@mysten /walrus) trên testnet và gặp lỗi này khi tôi cố tải lên tệp bằng writeBlob ():

NotEnoughBlobConfirmationsError: Too many failures while writing blob H1JLtHA4... to nodes

chỉ tự hỏi các nút lưu trữ testnet đang bị hỏng hay bị bong tróc ngay bây giờ? Hay tôi đang bỏ lỡ điều gì đó ngu ngốc ở phía tôi?

1
Câu trả lời hay nhất
Bình luận
.
24p30p.
Jul 14 2025, 12:41

✅ Mẫu khởi động sẵn sàng cho GitHub: Bảng điều khiển Walrus

Ngăn xếp công nghệ:

  • React + Vite (nhanh hơn CRA)
  • Tailwind CSS để tạo kiểu
  • @mysten/sui.jscho Sui RPC và ví
  • Biểu đồ lại cho biểu đồ
  • Sustand cho quản lý nhà nước

Cấu trúc thư mục:

walrus-dashboard/
├── public/
├── src/
│   ├── components/
│   │   ├── WalletConnect.tsx
│   │   ├── ProtocolStats.tsx
│   │   ├── MyPositions.tsx
│   │   └── Chart.tsx
│   ├── state/
│   │   └── useSuiStore.ts
│   ├── App.tsx
│   └── main.tsx
├── index.html
├── tailwind.config.js
└── vite.config.ts

1.** WalletConnect.tsx**

import { useWallet } from '@mysten/wallet-kit';

export default function WalletConnect() {
  const { connect, disconnect, connected, currentAccount } = useWallet();

  return (
    <div className="p-4">
      {connected ? (
        <div>
          <p>Connected: {currentAccount?.address.slice(0, 10)}...</p>
          <button onClick={disconnect} className="bg-red-500 p-2 text-white">Disconnect</button>
        </div>
      ) : (
        <button onClick={() => connect()} className="bg-blue-500 p-2 text-white">Connect Wallet</button>
      )}
    </div>
  );
}

2.ProtocolStats.tsx

import { useEffect, useState } from 'react';
import { SuiClient } from '@mysten/sui.js/client';

const client = new SuiClient({ url: 'https://fullnode.testnet.sui.io' });

export default function ProtocolStats() {
  const [tvl, setTvl] = useState(0);

  useEffect(() => {
    async function fetchTVL() {
      // Replace with real on-chain object ID
      const obj = await client.getObject({
        id: '0x...vault_id',
        options: { showContent: true }
      });
      const balance = parseInt(obj.data.content.fields.total_deposits);
      setTvl(balance / 1e9); // assuming 9 decimals
    }

    fetchTVL();
  }, []);

  return (
    <div className="bg-white shadow p-4 rounded">
      <h2 className="text-xl font-semibold">Protocol TVL</h2>
      <p className="text-3xl">${tvl.toLocaleString()}</p>
    </div>
  );
}

3.** chính.tsx**

import React from 'react';
import ReactDOM from 'react-dom/client';
import App from './App';
import './index.css';

ReactDOM.createRoot(document.getElementById('root')!).render(
  <React.StrictMode>
    <App />
  </React.StrictMode>,
);

4.** Ứng dụng.TSX**

import WalletConnect from './components/WalletConnect';
import ProtocolStats from './components/ProtocolStats';

function App() {
  return (
    <div className="min-h-screen bg-gray-100 p-6">
      <WalletConnect />
      <div className="mt-8">
        <ProtocolStats />
      </div>
    </div>
  );
}

export default App;

5.** Thiết lập gió tới**

npm install -D tailwindcss postcss autoprefixer
npx tailwindcss init -p

Sau đó cập nhật tailwind.config.jsvà cho index.cssphù hợp.


Các tính năng tiếp theo bạn có thể thêm:

  • Khai thác tiền gửi và cho vay của người dùng (MyPositions.tsx)
  • Thêm biểu đồ TVL với Recharts
  • Thêm cảnh báo thanh lý
  • Mô phỏng sui move calltừ frontend bằng cách sử dụng SuiClient

0
Bình luận
.

Bạn có biết câu trả lời không?

Hãy đăng nhập và chia sẻ nó.

Sui is a Layer 1 protocol blockchain designed as the first internet-scale programmable blockchain platform.

420Bài viết611Câu trả lời
Sui.X.Peera.

Kiếm phần của bạn từ 1000 Sui

Tích lũy điểm danh tiếng và nhận phần thưởng khi giúp cộng đồng Sui phát triển.

Chiến dịch phần thưởngTháng Bảy