We want to send ETH with transaction:send endpoint. Add all wallets to api key and also all permissions. We can send BTC successfully. Here is the implementation. The problem is when sending ETH the api service convert it to BTC and send the given address from BTC wallet. We want to send directly ETH from ETH wallet. Can anyone help? Where is the problem cannot figure it out.
var timestamp = DateTime.now().millisecondsSinceEpoch ~/ 1000;
var body = jsonEncode({"type": "send", "to": email, "amount": amount, "currency": currency});
var req = {
'method': 'POST',
'path': "/v2/accounts/accountId/transactions",
'body': body,
};
var message = '$timestamp${req['method']}${req['path']}${req['body']}';
var hmac = Hmac(sha256, utf8.encode(apiSecret));
var signature = hmac.convert(utf8.encode(message)).toString();
var headers = {
'CB-ACCESS-SIGN': signature,
'CB-ACCESS-TIMESTAMP': timestamp.toString(),
'CB-ACCESS-KEY': apiKey,
'CB-VERSION': '2022-03-14',
};
var baseUrl = 'https://api.coinbase.com';
var url = Uri.parse(baseUrl + req['path'].toString());
var response = await http.post(url, body: body, headers: headers);
if (response.statusCode == 200 || response.statusCode == 201) {
print(response.body);
} else {
print('Request failed with status: ${response.statusCode} Body: ${response.body}');
}