Skip to content

Commit

Permalink
invoice: improve type name API by builder
Browse files Browse the repository at this point in the history
  • Loading branch information
dr-orlovsky committed Dec 30, 2023
1 parent 1ce497f commit cfa4f7a
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions invoice/src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
use std::str::FromStr;

use rgb::ContractId;
use strict_encoding::{FieldName, TypeName};

use super::{Beneficiary, InvoiceState, Precision, RgbInvoice, RgbTransport, TransportParseError};
use crate::invoice::XChainNet;
Expand Down Expand Up @@ -62,18 +63,18 @@ impl RgbInvoiceBuilder {
self
}

pub fn set_interface(mut self, name: &'static str) -> Self {
self.0.iface = Some(tn!(name));
pub fn set_interface(mut self, name: impl Into<TypeName>) -> Self {
self.0.iface = Some(name.into());
self
}

pub fn set_operation(mut self, name: &'static str) -> Self {
self.0.operation = Some(tn!(name));
pub fn set_operation(mut self, name: impl Into<TypeName>) -> Self {
self.0.operation = Some(name.into());
self
}

pub fn set_assignment(mut self, name: &'static str) -> Self {
self.0.assignment = Some(fname!(name));
pub fn set_assignment(mut self, name: impl Into<FieldName>) -> Self {
self.0.assignment = Some(name.into());
self
}

Expand Down

0 comments on commit cfa4f7a

Please sign in to comment.