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()