Skip to content

CIP-0030 Suggestions #171

@mkazlauskas

Description

@mkazlauskas

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.

Is the dApp supposed to try to call the method with {limit: Number.POSITIVE_INFINITY} to figure out max size? I think it's an odd API and if we keep the concept of pagination there should be a way to get the limit without an error.

type TransactionUnspentOutput = cbor<transaction_unspent_output>
...
api.getUtxos(amount: cbor<value> = undefined, paginate: Paginate = undefined): Promise<TransactionUnspentOutput[] | undefined>

I initially thought that TransactionUnspentOutput wasn't cbor, the definition could use better consistency: I think we should either define all types as cbor<[type]> or list all type definitions under Data Types.

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>[]>.

The wallet is free to return thereject with TxSendError

@rooooooooob

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions