27 lines
1.3 KiB
Dart
27 lines
1.3 KiB
Dart
// ============================================================
|
||
// TradingProvider — 交易 Riverpod Providers
|
||
// ============================================================
|
||
|
||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||
import '../../../../core/network/api_client.dart';
|
||
|
||
// ── 市场列表(暂无专属接口,复用券列表代替)──────────────────────
|
||
// 后端无 /trading/markets,由上层页面使用 coupon 列表替代
|
||
|
||
// ── 订单簿 ────────────────────────────────────────────────────
|
||
|
||
final orderBookProvider =
|
||
FutureProvider.autoDispose.family<dynamic, String>((ref, couponId) async {
|
||
final api = ApiClient.instance;
|
||
final resp = await api.get('/api/v1/trades/orderbook/$couponId');
|
||
return resp.data['data'];
|
||
});
|
||
|
||
// ── 我的挂单 ──────────────────────────────────────────────────
|
||
|
||
final myOpenOrdersProvider = FutureProvider.autoDispose((ref) async {
|
||
final api = ApiClient.instance;
|
||
final resp = await api.get('/api/v1/trades/my/orders');
|
||
return resp.data['data'];
|
||
});
|