I have a set of addresses and resources
[
{address1, resource1},
{address2, resource2},
{address3, resrouce3},
...
]
I want to read from every address the assigned resource.
Right now I am calling the API .../accounts/" + address + "/resource/" + resource
for every address, which is slow (because of the multiple requests).
I want, if it's possible, to create a contract with a view function which is receiving the set of addresses and resources and then return a list with pulled data.
The only code which I managed is
module firstapp_addr::firstapp {
#[view]
public fun getResources(){
}
}
I have no idea how I can write this function. This is my first interaction with move
.
If someone can give me at least some examples.
I am also open to other solutions if the result is 1 request for all data
.
Thank you.
You can use this function structure as starting point :
Hoping it will be useful