Skip to content

Admin API ๋ฌธ์„œ โ€‹

Base URL โ€‹

https://flutterdev.online/api

์ธ์ฆ โ€‹

ํ˜„์žฌ ์ธ์ฆ ์—†์ด ์‚ฌ์šฉ ๊ฐ€๋Šฅ (๋‚ด๋ถ€ ๋„คํŠธ์›Œํฌ ์ „์šฉ)


Health Check โ€‹

GET /health โ€‹

์„œ๋ฒ„ ๋ฐ ๋ธ”๋ก์ฒด์ธ ์—ฐ๊ฒฐ ์ƒํƒœ ํ™•์ธ

Response:

json
{
  "status": "ok",
  "blockNumber": 12345
}

Wallets โ€‹

GET /wallets โ€‹

๋ชจ๋“  ์ง€๊ฐ‘ ๋ชฉ๋ก ์กฐํšŒ

Response:

json
[
  {
    "id": 1,
    "name": "Main Wallet",
    "address": "0x...",
    "balance": "1000000000.0",
    "created_at": "2024-01-01T00:00:00.000Z"
  }
]

GET /wallets/:id โ€‹

๋‹จ์ผ ์ง€๊ฐ‘ ์ƒ์„ธ ์กฐํšŒ (Private Key ํฌํ•จ)

Response:

json
{
  "id": 1,
  "name": "Main Wallet",
  "address": "0x...",
  "private_key": "0x...",
  "balance": "1000000000.0",
  "created_at": "2024-01-01T00:00:00.000Z"
}

POST /wallets โ€‹

์ƒˆ ์ง€๊ฐ‘ ์ƒ์„ฑ

Request:

json
{
  "name": "My Wallet"
}

Response:

json
{
  "id": 2,
  "name": "My Wallet",
  "address": "0x...",
  "private_key": "0x...",
  "balance": "0",
  "mnemonic": "word1 word2 ... word12"
}

POST /wallets/import โ€‹

๊ธฐ์กด ์ง€๊ฐ‘ ๊ฐ€์ ธ์˜ค๊ธฐ

Request:

json
{
  "name": "Imported Wallet",
  "privateKey": "0x..."
}

Response:

json
{
  "id": 3,
  "name": "Imported Wallet",
  "address": "0x...",
  "balance": "100.0"
}

DELETE /wallets/:id โ€‹

์ง€๊ฐ‘ ์‚ญ์ œ

Response:

json
{
  "success": true
}

Balance โ€‹

GET /balance/:address โ€‹

์ฃผ์†Œ์˜ ETH ์ž”์•ก ์กฐํšŒ

Response:

json
{
  "address": "0x...",
  "balance": "100.5",
  "wei": "100500000000000000000"
}

Transactions โ€‹

GET /transactions โ€‹

ํŠธ๋žœ์žญ์…˜ ๊ธฐ๋ก ์กฐํšŒ (์ตœ๊ทผ 100๊ฐœ)

Response:

json
[
  {
    "id": 1,
    "tx_hash": "0x...",
    "from_address": "0x...",
    "to_address": "0x...",
    "amount": "1.0",
    "status": "confirmed",
    "block_number": 12345,
    "created_at": "2024-01-01T00:00:00.000Z"
  }
]

POST /send โ€‹

์ง€๊ฐ‘ ID๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ETH ์ „์†ก

Request:

json
{
  "fromWalletId": 1,
  "toAddress": "0x...",
  "amount": "1.5"
}

Response:

json
{
  "hash": "0x...",
  "from": "0x...",
  "to": "0x...",
  "amount": "1.5",
  "status": "pending"
}

POST /send-direct โ€‹

Private Key๋ฅผ ์ง์ ‘ ์‚ฌ์šฉํ•˜์—ฌ ETH ์ „์†ก

Request:

json
{
  "privateKey": "0x...",
  "toAddress": "0x...",
  "amount": "1.0"
}

Response:

json
{
  "hash": "0x...",
  "from": "0x...",
  "to": "0x...",
  "amount": "1.0",
  "status": "confirmed",
  "blockNumber": 12346
}

Network โ€‹

GET /network โ€‹

๋„คํŠธ์›Œํฌ ์ •๋ณด ์กฐํšŒ

Response:

json
{
  "chainId": "3151908",
  "blockNumber": 12345,
  "gasPrice": "0.000000001"
}

Server Status โ€‹

GET /server-status โ€‹

์„œ๋ฒ„ ์‹œ์Šคํ…œ ์ƒํƒœ ์กฐํšŒ

Response:

json
{
  "disks": [
    {
      "filesystem": "/dev/vda1",
      "size": "50G",
      "used": "25G",
      "available": "25G",
      "usePercent": 50,
      "mountPoint": "/"
    }
  ],
  "memory": {
    "total": "16G",
    "used": "8G",
    "free": "4G",
    "available": "8G"
  },
  "dockerContainers": 10,
  "uptime": "5d 12h 30m",
  "timestamp": "2024-01-01T12:00:00.000Z"
}

์˜ค๋ฅ˜ ์‘๋‹ต โ€‹

๋ชจ๋“  API๋Š” ์˜ค๋ฅ˜ ์‹œ ๋‹ค์Œ ํ˜•์‹์œผ๋กœ ์‘๋‹ต:

json
{
  "error": "Error message here"
}

HTTP ์ƒํƒœ ์ฝ”๋“œ:

  • 400: Bad Request (์ž˜๋ชป๋œ ์š”์ฒญ)
  • 404: Not Found (๋ฆฌ์†Œ์Šค ์—†์Œ)
  • 500: Internal Server Error (์„œ๋ฒ„ ์˜ค๋ฅ˜)

์˜ˆ์ œ โ€‹

curl โ€‹

bash
# ์ง€๊ฐ‘ ๋ชฉ๋ก ์กฐํšŒ
curl https://flutterdev.online/api/wallets

# ์ƒˆ ์ง€๊ฐ‘ ์ƒ์„ฑ
curl -X POST https://flutterdev.online/api/wallets \
  -H "Content-Type: application/json" \
  -d '{"name": "Test Wallet"}'

# ETH ์ „์†ก
curl -X POST https://flutterdev.online/api/send \
  -H "Content-Type: application/json" \
  -d '{"fromWalletId": 1, "toAddress": "0x...", "amount": "0.1"}'

JavaScript (fetch) โ€‹

javascript
// ์ง€๊ฐ‘ ๋ชฉ๋ก ์กฐํšŒ
const wallets = await fetch('https://flutterdev.online/api/wallets')
  .then(res => res.json());

// ETH ์ „์†ก
const result = await fetch('https://flutterdev.online/api/send', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    fromWalletId: 1,
    toAddress: '0x...',
    amount: '1.0'
  })
}).then(res => res.json());

Python (requests) โ€‹

python
import requests

# ์ง€๊ฐ‘ ๋ชฉ๋ก ์กฐํšŒ
wallets = requests.get('https://flutterdev.online/api/wallets').json()

# ETH ์ „์†ก
result = requests.post('https://flutterdev.online/api/send', json={
    'fromWalletId': 1,
    'toAddress': '0x...',
    'amount': '1.0'
}).json()

FlutterDev Private Blockchain Platform