Skip to content

Commit

Permalink
feat: add new method to retrieve the wallet address by its id
Browse files Browse the repository at this point in the history
  • Loading branch information
nekofar committed Jul 15, 2021
1 parent 93b729a commit 3036d06
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
9 changes: 9 additions & 0 deletions lib/nobitex.dart
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,13 @@ class Nobitex {

return jsonDecode(response.body) as Map<String, dynamic>?;
}

Future<Map<String, dynamic>?> getWalletAddress({required String wallet}) async {
var url = Uri.https(basePath, '/users/wallets/generate-address');

var response = await http.post(url,
headers: {'Authorization': 'Token ' + token}, body: {'wallet': wallet});

return jsonDecode(response.body) as Map<String, dynamic>?;
}
}
7 changes: 7 additions & 0 deletions test/nobitex_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,12 @@ void main() {

expect(data!.containsKey('deposits'), true);
});

test('test getWalletAddress', () async {
var data = await nobitex.getWalletAddress(
wallet: env['NOBITEX_WALLET'] as String);

expect(data!.containsKey('address'), true);
});
});
}

0 comments on commit 3036d06

Please sign in to comment.