Skip to content

Commit

Permalink
Merge pull request #23 from gevulotnetwork/fix/make-cid-optional-in-c…
Browse files Browse the repository at this point in the history
…reate-pin-msg-builder

make cid optional in create-pin-msg builder
  • Loading branch information
trusch authored Nov 28, 2024
2 parents f05d6b1 + e524bd8 commit e972c7c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/builders.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ impl MsgCreateTaskBuilder {
#[derive(Builder)]
pub struct MsgCreatePin {
pub creator: String,
pub cid: String,
pub cid: Option<String>,
pub bytes: ByteSize,
pub name: String,
pub redundancy: u64,
Expand All @@ -168,7 +168,7 @@ impl MsgCreatePinBuilder {
.map_err(|e| Error::EncodeError(e.to_string()))?;
Ok(gevulot::MsgCreatePin {
creator: msg.creator,
cid: msg.cid,
cid: msg.cid.unwrap_or_default(),
bytes: msg.bytes.to_bytes(),
name: msg.name,
redundancy: msg.redundancy,
Expand Down
4 changes: 3 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,9 @@ mod tests {
// Create a pin
let pin_msg = builders::MsgCreatePinBuilder::default()
.creator(address.clone())
.cid("QmSWeBJYvDqKUFG3om4gsrKGf379zk8Jq5tYXpDp7Xo".to_string())
.cid(Some(
"QmSWeBJYvDqKUFG3om4gsrKGf379zk8Jq5tYXpDp7Xo".to_string(),
))
.bytes((32, Byte).into())
.time(3600)
.redundancy(1)
Expand Down

0 comments on commit e972c7c

Please sign in to comment.