Last active
September 23, 2020 07:02
-
-
Save Zfinix/87f3dfed38e9ae2b82694477247ea06e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import 'dart:convert'; | |
| import 'package:convert/convert.dart'; | |
| import 'package:crypto/crypto.dart'; | |
| import 'package:http/http.dart' as http; | |
| encode() async { | |
| var secret = 'aefij3ldaase_ase23fdAdwjnA2123fFa'; | |
| var body = 'apikey=' + | |
| 'dgsdrij234fsdfgkhr' + | |
| '&nonce=' + | |
| DateTime.now().millisecondsSinceEpoch.toString() + | |
| '&offer_hash=Agq1Bpw7oX9&margin=50'; | |
| var hmacEncoder = new Hmac(sha256, secret); // HMAC-SHA256 | |
| var seal = hmacEncoder.convert(body); | |
| var headers = { | |
| 'Content-type': 'application/json;charset=UTF-8', | |
| 'Accept': 'application/json', | |
| }; | |
| var response = await http.post( | |
| "https://www.paxful.com/api/offer/list&apiseal=$seal", | |
| body: body, | |
| headers: headers); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment