Skip to content

Commit

Permalink
iface: use verbose assignment names in builder add_asset_tag method
Browse files Browse the repository at this point in the history
  • Loading branch information
dr-orlovsky committed Nov 18, 2023
1 parent 8fe755b commit 1cc293c
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions src/interface/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,10 +143,10 @@ impl ContractBuilder {
#[inline]
pub fn add_asset_tag(
mut self,
assignment_type: AssignmentType,
name: impl Into<FieldName>,
asset_tag: AssetTag,
) -> Result<Self, BuilderError> {
self.builder = self.builder.add_asset_tag(assignment_type, asset_tag)?;
self.builder = self.builder.add_asset_tag(name, asset_tag, None)?;
Ok(self)
}

Expand Down Expand Up @@ -261,10 +261,12 @@ impl TransitionBuilder {
#[inline]
pub fn add_asset_tag(
mut self,
assignment_type: AssignmentType,
name: impl Into<FieldName>,
asset_tag: AssetTag,
) -> Result<Self, BuilderError> {
self.builder = self.builder.add_asset_tag(assignment_type, asset_tag)?;
self.builder = self
.builder
.add_asset_tag(name, asset_tag, Some(self.transition_type))?;
Ok(self)
}

Expand Down Expand Up @@ -420,10 +422,16 @@ impl<Seal: ExposedSeal> OperationBuilder<Seal> {
#[inline]
pub fn add_asset_tag(
mut self,
assignment_type: AssignmentType,
name: impl Into<FieldName>,
asset_tag: AssetTag,
ty: Option<TransitionType>,
) -> Result<Self, BuilderError> {
self.asset_tags.insert(assignment_type, asset_tag)?;
let name = name.into();
let type_id = self
.assignments_type(&name, ty)
.ok_or(BuilderError::AssignmentNotFound(name))?;

self.asset_tags.insert(type_id, asset_tag)?;
Ok(self)
}

Expand Down

0 comments on commit 1cc293c

Please sign in to comment.