createZainbox method

Future<CreateZainboxResponse?> createZainbox()

Executes network call to initiate transactions

Implementation

Future<CreateZainboxResponse?> createZainbox() async {

  CreateZainboxResponse? createZainboxResponse = CreateZainboxResponse();

  final url = "${Utils.getBaseUrl(isTest)}/${Utils.createZainboxUrl}";

  final response = await http.post(Uri.parse(url),
      headers: {
        "Authorization" : "Bearer $publicKey",
        "Content-Type" : "application/json"
      },
      body: toString()
  );

    final responseBody = jsonDecode(response.body);
    createZainboxResponse = CreateZainboxResponse.fromJson(responseBody);

  return createZainboxResponse;
}