Skip to content

Instantly share code, notes, and snippets.

@Adesubomi
Created August 18, 2022 21:35
Show Gist options
  • Save Adesubomi/1473a6dc63390508c81c18136977a5d2 to your computer and use it in GitHub Desktop.
Save Adesubomi/1473a6dc63390508c81c18136977a5d2 to your computer and use it in GitHub Desktop.
Url
/v1/sofa/wallets/454783/addresses
Post Body
{count: 1, labels: [“customer-a”]}
Curl request
============
curl -X POST -H "Content-Type: application/json" \
-d '{"count":2,”labels”:[“customer-a”]}' \
http://{baseUrl}/v1/sofa/wallets/454783/addresses?r=kT8STb6j6&t=1660832386
/* - - - - - - Checksum with request body - - - - - */
$params = []
array_push($params, “t=1660832386”); // [“t=1660832386”, “r=kT8STb6j6”]
array_push($params, “r=kT8STb6j6wy”); // [“t=1660832386”, “r=kT8STb6j6”]
array_push("{"count":2,"labels":["customer-a"]}");
// [“t=1660832386", “r=kT8STb6j6”, "{"count":2,”labels”:[“customer-a”]}"]
sort($params);
array_push($params, "secret=". $this->apiSecret);
// [“r=kT8STb6j6”, “t=1660832386", "{"count":2,”labels”:[“customer-a”]}", "secret=jsiejf"]
$params_str = implode("&", $params);
// r=kT8STb6j6&t=1660832386&{"count":2,”labels”:[“customer-a”]}&secret=jsiejf
$checksum = hash("sha256", $params_str);
// f63724ed2b1e1e1eddc378592dc8c55b4d1553d76add54c4eb3b17945c968a75
/* - - - - - - Checksum WITHOUT request body - - - - - */
$params = []
array_push($params, “t=1660832386”); // [“t=1660832386”, “r=kT8STb6j6”]
array_push($params, “r=kT8STb6j6wy”); // [“t=1660832386”, “r=kT8STb6j6”]
// [“t=1660832386", “r=kT8STb6j6”]
sort($params);
// [“r=kT8STb6j6”, “t=1660832386", ]
array_push($params, "secret=". $this->apiSecret);
// [“r=kT8STb6j6”, “t=1660832386", "secret=jsiejf"]
$params_str = implode("&", $params);
// r=kT8STb6j6&t=1660832386&secret=jsiejf
$checksum = hash("sha256", $params_str);
// 631dbfeac7080c57fc18191d4d358cfe3a7a0229b0bc319a31fff2f01619fcfc
Url
/v1/sofa/wallets/454783/addresses?start_index=1&request_number=50
Curl request
============
curl -H "Content-Type: application/json" \
http://{baseUrl}/v1/sofa/wallets/454783/addresses?start_index=1&request_number=50&r=kT8STb6j6&t=1660832386
/* - - - - - - Checksum WITHOUT request body - - - - - */
$params = ["start_index=1", "request_number=50"]
array_push($params, “t=1660832386”);
array_push($params, “r=kT8STb6j6”);
sort($params);
// ["r=kT8STb6j6", "request_number=50", "start_index=1", "t=1660832386"]
array_push($params, "secret=jsiejf");
// ["r=kT8STb6j6", "request_number=50", "start_index=1", "t=1660832386", "secret=jsiejf"]
$params_str = implode("&", $params);
// r=kT8STb6j6&request_number=50&start_index=1&t=1660832386&secret=jsiejf
$checksum = hash("sha256", $params_str);
// 9ccbc51d433363c6a0b49f62fa7fa7d74229591c9770414aaf2990eb740b2fa5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment