Skip to content

Commit

Permalink
Changed undefined return to null
Browse files Browse the repository at this point in the history
Replaced undefined with null to be compatible with cardano-foundation#181
  • Loading branch information
vsubhuman committed Feb 4, 2022
1 parent 551f09e commit 17998d9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions CIP-0030/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -197,11 +197,11 @@ Errors: `APIError`, `PaginateError`

If `amount` is `undefined`, this shall return a list of all UTXOs (unspent transaction outputs) controlled by the wallet. If `amount` is not `undefined`, this request shall be limited to just the UTXOs that are required to reach the combined ADA/multiasset value target specified in `amount`, and if this cannot be attained, `undefined` shall be returned. The results can be further paginated by `paginate` if it is not `undefined`.

### api.getCollateralUtxos(amount: cbor\<Coin>): Promise\<TransactionUnspentOutput[] | undefined>
### api.getCollateralUtxos(amount: cbor\<Coin>): Promise\<TransactionUnspentOutput[] | null>

Errors: `APIError`

The `amount` is required. This shall return a list of all UTXOs (unspent transaction outputs) controlled by the wallet that are required to reach the combined ADA value target specified in `amount` **AND** the best suitable to be used as collateral inputs for transactions with plutus script inputs. If this cannot be attained, `undefined` shall be returned.
The `amount` is required. This shall return a list of all UTXOs (unspent transaction outputs) controlled by the wallet that are required to reach the combined ADA value target specified in `amount` **AND** the best suitable to be used as collateral inputs for transactions with plutus script inputs. If this cannot be attained, `null` shall be returned.

The main point is to allow the wallet to encapsulate all the logic required to handle, maintain, and create (possibly on-demand) the UTXOs suitable for collateral inputs. For example, whenever attempting to create a plutus-input transaction the dapp might encounter a case when the set of all user UTXOs don't have any pure entries at all, which are required for the collateral, in which case the dapp itself is forced to try and handle the creation of the suitable entries by itself. If a wallet implements this function it allows the dapp to not care whether the suitable utxos exist among all utxos, or whether they have been stored in a separate address chain (see https://github.com/cardano-foundation/CIPs/pull/104), or whether they have to be created at the moment on-demand - the wallet guarantees that the dapp will receive enough utxos to cover the requested amount, or get an error in case it is technically impossible to get collateral in the wallet (e.g. user does not have enough ADA at all).

Expand Down

0 comments on commit 17998d9

Please sign in to comment.