RGB-WG / rgb-std

RGB standard libs for WASM & low-level integrations (no FS/networking)

Home Page:https://rgb.tech

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Prefix for invoice state types

crisdut opened this issue · comments

Description

I'm working on non-fungible support for invoices, and I think we need to add a prefix to identify the type of invoice state.

For example:

# Suggestion 1: For amounts
rgb:(..)/RGB20/amount:100+bc:utxob:egXsFnw-5Eud7WKYn-7DVQvcPbc-rR69YmgmG-veacwmUFo-uMFKFb

# Suggestion 2: For general data
rgb:(..)/RGB21/data:0000000100000001+bc:utxob:egXsFnw-5Eud7WKYn-7DVQvcPbc-rR69YmgmG-veacwmUFo-uMFKFb

# Suggestion 3: For specific data (For example, RGB21 interface token allocation)
rgb:(..)/RGB21/allocation:0000000100000001+bc:utxob:egXsFnw-5Eud7WKYn-7DVQvcPbc-rR69YmgmG-veacwmUFo-uMFKFb

What do you think?

Thanks

I think Maxim has suggested that this follow RFC 3986 URI format, so perhaps a better format is:

# Suggestion 1: For amounts
rgb:(..)/RGB20/?amount=100&bc=utxob:egXsFnw-5Eud7WKYn-7DVQvcPbc-rR69YmgmG-veacwmUFo-uMFKFb

# Suggestion 2: For general data
rgb:(..)/RGB21/?data=0000000100000001&bc=utxob:egXsFnw-5Eud7WKYn-7DVQvcPbc-rR69YmgmG-veacwmUFo-uMFKFb

# Suggestion 3: For specific data (For example, RGB21 interface token allocation)
rgb:(..)/RGB21/?allocation=0000000100000001&bc=utxob:egXsFnw-5Eud7WKYn-7DVQvcPbc-rR69YmgmG-veacwmUFo-uMFKFb

I think Maxim has suggested that this follow RFC 3986 URI format, so perhaps a better format is:

# Suggestion 1: For amounts
rgb:(..)/RGB20/?amount=100&bc=utxob:egXsFnw-5Eud7WKYn-7DVQvcPbc-rR69YmgmG-veacwmUFo-uMFKFb

# Suggestion 2: For general data
rgb:(..)/RGB21/?data=0000000100000001&bc=utxob:egXsFnw-5Eud7WKYn-7DVQvcPbc-rR69YmgmG-veacwmUFo-uMFKFb

# Suggestion 3: For specific data (For example, RGB21 interface token allocation)
rgb:(..)/RGB21/?allocation=0000000100000001&bc=utxob:egXsFnw-5Eud7WKYn-7DVQvcPbc-rR69YmgmG-veacwmUFo-uMFKFb

Humm.. the prefix "bc" is not a parameter, but the new format of the seal, and amount/data is like a path parameter. I think we can define state_format as optional parameter, see below:

# Suggestion 3: For specific data (For example, RGB21 interface token allocation)
rgb:(..)/RGB21/0000000100000001+bc:utxob(...)?state_type=allocation

I think the more human-readable invoice is the better it is.

The invoice already contains interface information, and it is interface which defines the type of the state. Thus, we can avoid using query at all, remain RGB20 as is and for RGB21 do the following:

rgb:~/RGB21/0.5@1+utxob:egXsFnw-5Eud7WKYn-7DVQvcPbc-rR69YmgmG-veacwmUFo-uMFKFb

i.e. <fraction>@<token_index>+<seal> which still matches URL spec and reads as "0.5 of token index 1 to this single-use seal in the form of blinded UTXO".

Invoice library now must become aware of the main interfaces and parse data into something like

enum Nonfungible {
   Rgb21(Allocation),
   Rgb22(...)
}

where Allocation is what you did in your PR https://github.com/RGB-WG/rgb-std/pull/134?notification_referrer_id=NT_kwDOAAWtQrE5MTI0NDE1MDEzOjM3MjAzNA&notifications_query=repo%3ARGB-WG%2Frgb-std

I only saw this comment now, after I responded to the PR review about invoice.

Well, I'll update it to follow your comments, ok?