seredat / karbowanec

Karbo (Karbovanets) - Digital Exchange Medium - cryptocurrency made in Ukraine, CryptoNote protocol implementation.
https://karbo.io/
Other
104 stars 66 forks source link

Add simplewallet RPC get_last_transfers method #155

Closed aivve closed 3 years ago

aivve commented 3 years ago

Add get_last_transfers RPC method for simplewallet because get_transfers may be overkill for wallets with a lots of transactions.

There is a count param to specify how many last transactions to fetch.

Input:

{
  "jsonrpc": "2.0",
  "id": "test",
  "method": "get_last_transfers",
  "params": {
   "count":100
  }
}

Output is the same as in get_transfers method.

aivve commented 3 years ago

Also, rename getbalance method to get_balance for consistency with other methods because in all of them there is an underscore _ to separate words.

aivve commented 3 years ago

count defaults to 1000. Too much? 🤔

rublin commented 3 years ago

count defaults to 1000. Too much? thinking

I thought 100 is ok, but sometimes 1000 can be better.

aivve commented 3 years ago

Fun fact, in response to count = 0 it returns empty transfers array :) If count = -1 it returns all txs just like get_transfers

aivve commented 3 years ago

It is also worth noting that transfers for this method are not in reverse order, i.e. the first transfers are older, the last will be most recent.