0

Following what I think is the official EOS documentation for get_actions . I stumble upon the parameters pos and offset, but they are not documented anywhere.

Can somebody explain to me, what these parameters do, and how to use them? Thanks a lot in advance.

0

UPDATE:

After doing some fiddling, here is what I learned (though an official explanation is nowhere to be found :/ ) :

Let's say an account has 128 actions, then we make the following calls:

<server>/v1/history/get_actions(<account_name>, pos=100, offset=-100)

This gets us the earliest 100 actions.

<server>/v1/history/get_actions(<account_name>, pos=200, offset=-100)

This gets us the latest 28 actions.

So in other words, we can get all actions for an account (provided that we ask a full history node, which is a longer story). But we will get them in chronological order, and not latest first. And we do this by running a loop where we increment pos variable until we do not receive any more actions. Some pseudo code:

var pos = 100;
while(moreFetched)
{
    var actions = _urlHandler.Post(...);
    if(actions == null) break;

    pos += 100;
}

But it would still be very nice (and appropriate) to get a professional review of this approach.

And here is some info regarding blockchain history: https://medium.com/@cc32d9/history-and-notifications-in-eosio-blockchain-8255194af93

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.