Skip to content

add API to return the number of allocation slots #31

@nicbus

Description

@nicbus

RGB assets are allocated to colorable UTXOs. One UTXO can support more than one allocation, depending on the value of max_allocations_per_utxo (in WalletData) provided at wallet instantiation time.

It would be useful to be able to query how many available allocations slots the wallet has. An example use case would be to know if new colorable UTXOs need to be created, in advance rather in response to an error when e.g. calling blind_receive.

  • name: allocations
  • parameters: none
  • response: a new Allocations struct containing
    • total_available: the number of total available allocations
    • map: a map of UTXOs and the respective allocations (given the current value of max_allocations_per_utxo)
      • key: utxo
      • value:
        • used: the number of currently used allocations
        • available: the number of currently available allocations

With this data, the user can easily know:

  • if there is at least one available allocation
  • the total number of possible new allocations, before having to create more UTXOs
  • the number of UTXOs that can support a new allocation

Notes:

  • the number of used allocations can be obtained via get_rgb_allocations
  • the number of available allocations corresponds to the value of max_allocations_per_utxo minus the currently used allocations

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions