Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add API to return the number of allocation slots #31

Open
nicbus opened this issue Oct 26, 2023 · 0 comments
Open

add API to return the number of allocation slots #31

nicbus opened this issue Oct 26, 2023 · 0 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@nicbus
Copy link
Collaborator

nicbus commented Oct 26, 2023

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
@nicbus nicbus added enhancement New feature or request good first issue Good for newcomers labels Oct 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant