import 'package:chat/models/auth/auth_model.dart';
import 'package:chat/utils/network/http.dart';
import 'package:chat/utils/ui_tools.dart';

class AuthProvider {
  static Future<AuthModel?> login(String address) async {
    try {
      final result = await Http.post(
        'auth/login',
        data: {
          'address': address,
        },
      );

      return AuthModel.fromJson(result);
    } catch (e) {
      UiTools.toast('区块链地址获取失败 ${e.toString()}');
      return null;
    }
  }
}
