[Unofficial Axie Infinity Guide] Getting the total SLP using Maxbrand’s API proxy directly to the Google Sheet

iamdeadlyz
4 min readNov 13, 2020

Hello~

Just a quick guide on how to get the current SLP that you have on your account. If you are a manager for a scholarship program, then this would be really helpful.

If you want to skip the whole….fun process, you can make a copy out of this sheet: https://docs.google.com/spreadsheets/d/1ly7rSJBik1y-RVHWKSoKYdHwyAVcpkJKRluH5r-JbcQ/edit?usp=sharing

Creating the script

  1. Create a google sheet: http://sheets.google.com/
  2. Go to Tools, then select Script editor.

3. It will open a new tab with this UI

4. Delete everything and paste this script

/**
* Imports JSON data to your spreadsheet
* @param url URL of your JSON data as string
* @param xpath simplified xpath as string
* @customfunction
*/
function IMPORTJSON(url,xpath){
try{
var res = UrlFetchApp.fetch(url);
var content = res.getContentText();
var json = JSON.parse(content);
var patharray = xpath.split(".");
//Logger.log(patharray);
for(var i=0;i<patharray.length;i++){
json = json[patharray[i]];
}
//Logger.log(typeof(json));if(typeof(json) === "undefined"){
return "Node Not Available";
} else if(typeof(json) === "object"){
var tempArr = [];
for(var obj in json){
tempArr.push([obj,json[obj]]);
}
return tempArr;
} else if(typeof(json) !== "object") {
return json;
}
}
catch(err){
return "Error getting data";
}
}

//Disclaimer: I didn’t code such a script. Credits to the rightful owners.

5. Save it, and let’s name it as importJSON

Entering the formula v1

  1. Go back to the Google sheet that we created earlier. Enter this formula to the desired cell.
=importJSON("https://game-api.axie.technology/api/v1/<THE RONIN ADDRESS OF THE ACCOUNT, SHOULD START WITH 0x not ronin:>/items/1","total_slp")

It should look like this

=importJSON("https://game-api.axie.technology/api/v1/0x0000000000000000000000000000000000000000","total_slp")

2. You can now keep track of the SLPs.

The address is not mine.

Entering the formula v2

Instead of adding new ETH addresses to the new importJSON formulas, you can “automate” it by placing the ETH addresses in one column and the importJSON formulas on the other side.

=importJSON(concatenate("https://game-api.axie.technology/api/v1/",A3),"total_slp")

Replace A3 with the desired cell that contains the Ethereum address. Then press the small blue square in the cell and drag it down.

The addresses are not mine.

Adding timestamps

If you want to get the exact date and time when was the SLP claimed/synced, you can enter the following formula.

=importJSON("https://game-api.axie.technology/api/v1/0x0000000000000000000000000000000000000000","last_claim")

And you will get this output.

The address is not mine.

Now, we call those numbers Unix Timestamp. You can use this tool (https://www.epochconverter.com/) and enter the data to see how it translates.

Now, let's go back to our sheet. To convert it to a human-readable format, enter the following in the next cell.

=A1/86400+DATE(1970,1,1)+time(0,0,0)

A1 is the cell the contains the Unix Timestamp. We will reference it in our formula to make things easier. The “+time(0,0,0)” translates the data to UTC or GMT.

To match the timestamp with your local time, adjust the plus & minus operator, hours, minutes, and seconds respectively. Here are some examples:

GMT+8
=A1/86400+DATE(1970,1,1)+time(8,0,0)
EST
=A1/86400+DATE(1970,1,1)-time(5,0,0)

FAQs

  • Does the number of SLP update automatically?
    No. You have three options on how to update it:
    - Delete the formula, then undo
    - Refresh the page
    - Use the API Connector Google Sheet add on (paid version)
  • What’s the rate limit for the API?
    I have no idea. But please, don’t spam multiple requests!
  • I got an “Error getting data” output. How do I fix it?
    Double-check your eth address, remove double-spaces, or refresh the page again.
  • How often does Maxbrand’s proxy API update the data?
    Every 6 hours.

That’s it! Enjoy playing (and earning)!

Love the guide? Please clap for it and spread the word 😉

Follow me on Twitter~
https://twitter.com/Iamdeadlyz

Find me on Discord~
Iamdeadlyz#3884

--

--