I have a few suggestions and questions regarding CIP-0030.
Paginate
…
if a wallet is modified between paginated calls that this will change the pagination, e.g. some results skipped or showing up multiple times but otherwise the wallet must respect the pagination order.
To avoid this issue we could change API functions with pagination to return an async iterator instead of Promise
.
PaginateError
{maxSize} is the maximum size for pagination and if the dApp tries to request pages outside of this boundary this error is thrown.
How is the dApp supposed to figure out max size? Getting it from an error is an odd API and if we keep the concept of pagination there should be a way to get the limit before calling the function that supports pagination.
api.getBalance(): Promise<cbor<value>>
Does it include rewards and deposit? Need to make this explicit, as using these funds requires certificates in the transaction.
api.getUsedAddresses(paginate: Paginate = undefined): Promise<cbor<address>>
api.getUnusedAddresses(): Promise<cbor<address>>
There will be different types of wallets. Some might be single address and not have any unused addresses. Given this API, dApp will probably expect to always get some unused addresses, which might not be the case. The dApp itself can figure out if it was used or not. I suggest to consolidate these to api.getAddresses(paginate: Paginate = undefined): Promise<cbor<address>[]>
.