Skip to content

Name registry for Intents and IntentGroups #2562

@JoeCap08055

Description

@JoeCap08055

Name Resolution

In addition to the new & updated primitives for Schemas, Intents, and Intent Groups, this design also provides for a name resolution mechanism so that off-chain applications may discover the necessary on-chain identifiers. These facilities are solely for off-chain name resolution; all on-chain extrinsics and other calls will require the appropriate numeric identifier (i.e., SchemaId, IntentId, IntentGroupId).

Related names will be grouped under a top-level identifier called a 'protocol'. This enables querying the chain by a fully qualified name ., or by only for a list of registered names and their corresponding entities. For example, using data currently on Frequency Mainnet, we would have two protocols defined: 'dsnp' and ' bsky'. Each name registered to a protocol points to either an IntentId or a IntentGroupId. The structures for the name registry would look as follows:

pub enum RegisteredNameIdType {
    Intent(IntentId),
    IntentGroup(IntentGroupId),
}

/// Protocol name type
pub type ProtocolName = BoundedVec<u8, ConstU32<PROTOCOL_MAX>>;
/// descriptor type
pub type NameDescriptor = BoundedVec<u8, ConstU32<DESCRIPTOR_MAX>>;

Name Registry

The Name Registry structures will look as follows:

#[pallet::storage]
pub(super) type NameRegistry<T: Config> = StorageDoubleMap<
    _,
    Blake2_128Concat,
    ProtocolName,
    Blake2_128Concat,
    NameDescriptor,
    RegisteredNameIdType,
    ValueQuery,
>;

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions