-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathquick_test.sh
More file actions
executable file
·56 lines (49 loc) · 1.82 KB
/
quick_test.sh
File metadata and controls
executable file
·56 lines (49 loc) · 1.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/bin/bash
# 快速测试 Gas Estimate 功能
# 使用前请先启动服务: ./fishcake api
# 配置
TEST_ADDRESS="0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb"
RECEIVER="0x1234567890123456789012345678901234567890"
BASE_URL="http://localhost:8080"
echo "🧪 快速测试 Gas Estimate 功能"
echo "================================"
echo ""
# 测试 1: 基础查询
echo "📋 测试 1: 基础查询 (应该没有 gas_estimate)"
echo "---"
curl -s "${BASE_URL}/v1/chain_info/sign_info?address=${TEST_ADDRESS}" | jq '{
nonce: .data.nonce,
gas_estimate: .data.gas_estimate // "❌ 无 (正常)",
max_fee_per_gas: .data.max_fee_per_gas,
has_all_fields: (.data.nonce != null and .data.max_fee_per_gas != null)
}'
echo ""
echo ""
# 测试 2: 带 to 参数
echo "📋 测试 2: 带 to 参数 (应该有 gas_estimate)"
echo "---"
curl -s "${BASE_URL}/v1/chain_info/sign_info?address=${TEST_ADDRESS}&to=${RECEIVER}" | jq '{
nonce: .data.nonce,
gas_estimate: .data.gas_estimate // "❌ 预估失败",
max_fee_per_gas: .data.max_fee_per_gas,
has_gas_estimate: (.data.gas_estimate != null)
}'
echo ""
echo ""
# 测试 3: 完整参数
echo "📋 测试 3: 完整参数 (to + value)"
echo "---"
curl -s "${BASE_URL}/v1/chain_info/sign_info?address=${TEST_ADDRESS}&to=${RECEIVER}&value=0xde0b6b3a7640000" | jq '{
nonce: .data.nonce,
gas_estimate: .data.gas_estimate // "❌ 预估失败",
gas_estimate_number: (.data.gas_estimate | tonumber? // 0),
is_reasonable: ((.data.gas_estimate | tonumber? // 0) > 20000 and (.data.gas_estimate | tonumber? // 0) < 30000)
}'
echo ""
echo ""
echo "✅ 测试完成!"
echo ""
echo "💡 验证要点:"
echo " - 测试 1: has_all_fields 应该为 true, gas_estimate 应该为 null"
echo " - 测试 2: has_gas_estimate 应该为 true"
echo " - 测试 3: is_reasonable 应该为 true (gas 在 20k-30k 之间)"