-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathcryptoapis.gs
30 lines (27 loc) · 1.13 KB
/
cryptoapis.gs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// Crypto APIs Request in Google Apps Script (GAS).
// By Moosy Research, see more cryptosheets on: https://sites.google.com/view/moosyresearch
function CRA_GetBalances(){
var CRArequest = {
"id" : "CRA",
"name" : "Crypto APIs",
"command" : 'v1/bc/eth/',
"apikey" : "•••••••••",
"uri" : "https://api.cryptoapis.io/",
"method" : "GET",
"payload" : "••••••••• xxxxx" // address <space> network
}
var response = CRA_PrivateRequest(CRArequest);
Logger.log( JSON.parse(UrlFetchApp.fetch(response.uri, response.params)) );
}
function CRA_PrivateRequest(CRArequest) {
var params = {
method : CRArequest.method,
muteHttpExceptions : true,
headers : {
'Content-Type' : 'application/json',
'X-API-Key' : CRArequest.apikey
},
},
payload = CRArequest.payload.split(' ');
return { uri: CRArequest.uri + CRArequest.command + payload[1] + '/address/' + payload[0] , params: params};
}