Skip to content

Instantly share code, notes, and snippets.

@Zfinix
Last active September 23, 2020 07:02
Show Gist options
  • Select an option

  • Save Zfinix/87f3dfed38e9ae2b82694477247ea06e to your computer and use it in GitHub Desktop.

Select an option

Save Zfinix/87f3dfed38e9ae2b82694477247ea06e to your computer and use it in GitHub Desktop.
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